* gen gc
@ 2002-07-17 21:59 Han-Wen
2002-07-17 22:54 ` Marius Vollmer
0 siblings, 1 reply; 18+ messages in thread
From: Han-Wen @ 2002-07-17 21:59 UTC (permalink / raw)
How is this supposed to portable to GenGC?
SCM_DEFINE (scm_object_address, "object-address", 1, 0, 0,
(SCM obj),
"Return an integer that for the lifetime of @var{obj} is uniquely\n"
"returned by this function for @var{obj}")
This is used in some of the goops code -- should I retain it?
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-17 21:59 gen gc Han-Wen
@ 2002-07-17 22:54 ` Marius Vollmer
2002-07-17 23:12 ` Han-Wen
0 siblings, 1 reply; 18+ messages in thread
From: Marius Vollmer @ 2002-07-17 22:54 UTC (permalink / raw)
Cc: guile-devel
Han-Wen <hanwen@cs.uu.nl> writes:
> How is this supposed to portable to GenGC?
>
> SCM_DEFINE (scm_object_address, "object-address", 1, 0, 0,
> (SCM obj),
> "Return an integer that for the lifetime of @var{obj} is uniquely\n"
> "returned by this function for @var{obj}")
>
> This is used in some of the goops code -- should I retain it?
It would be cool if you could fake it. It doesn't need to be the real
memory address of the object, just a unique integer.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-17 22:54 ` Marius Vollmer
@ 2002-07-17 23:12 ` Han-Wen
2002-07-18 12:08 ` Miroslav Silovic
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Han-Wen @ 2002-07-17 23:12 UTC (permalink / raw)
Cc: guile-devel
mvo@zagadka.ping.de writes:
> Han-Wen <hanwen@cs.uu.nl> writes:
>
> > How is this supposed to portable to GenGC?
> >
> > SCM_DEFINE (scm_object_address, "object-address", 1, 0, 0,
> > (SCM obj),
> > "Return an integer that for the lifetime of @var{obj} is uniquely\n"
> > "returned by this function for @var{obj}")
> >
> > This is used in some of the goops code -- should I retain it?
>
> It would be cool if you could fake it. It doesn't need to be the real
> memory address of the object, just a unique integer.
?
What if I can't? Memory cells are going to move around. I don't see a
way to generate a unique number without making some kind of table for
objects subjected to object-address.
Btw, I can imagine that internal hash tables might use the address of
a cell as a source for a hash index. Does that happen anywhere?
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-17 23:12 ` Han-Wen
@ 2002-07-18 12:08 ` Miroslav Silovic
2002-07-18 12:08 ` Han-Wen Nienhuys
2002-07-18 16:00 ` Dirk Herrmann
2002-07-19 22:55 ` Marius Vollmer
2 siblings, 1 reply; 18+ messages in thread
From: Miroslav Silovic @ 2002-07-18 12:08 UTC (permalink / raw)
Cc: Marius Vollmer, guile-devel
Han-Wen wrote:
>mvo@zagadka.ping.de writes:
>
>
>>Han-Wen <hanwen@cs.uu.nl> writes:
>>
>>
>>
>>>How is this supposed to portable to GenGC?
>>>
>>> SCM_DEFINE (scm_object_address, "object-address", 1, 0, 0,
>>> (SCM obj),
>>> "Return an integer that for the lifetime of @var{obj} is uniquely\n"
>>> "returned by this function for @var{obj}")
>>>
>>>This is used in some of the goops code -- should I retain it?
>>>
>>>
>>It would be cool if you could fake it. It doesn't need to be the real
>>memory address of the object, just a unique integer.
>>
>>
>
>?
>
>What if I can't? Memory cells are going to move around. I don't see a
>way to generate a unique number without making some kind of table for
>objects subjected to object-address.
>
>
Actually it only says it should be unique, not never-changing. In
particular,
all it needs for eq? to grok it is uniqueness. I guess just returning
the address
ought to work, no?
Miro
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-18 12:08 ` Miroslav Silovic
@ 2002-07-18 12:08 ` Han-Wen Nienhuys
2002-07-19 3:59 ` Rob Browning
2002-07-19 22:58 ` Marius Vollmer
0 siblings, 2 replies; 18+ messages in thread
From: Han-Wen Nienhuys @ 2002-07-18 12:08 UTC (permalink / raw)
Cc: Marius Vollmer, guile-devel
miro@puremagic.com writes:
> >>> SCM_DEFINE (scm_object_address, "object-address", 1, 0, 0,
> >>> (SCM obj),
> >>> "Return an integer that for the lifetime of @var{obj} is uniquely\n"
> >>> "returned by this function for @var{obj}")
> >What if I can't? Memory cells are going to move around. I don't see a
> >way to generate a unique number without making some kind of table for
> >objects subjected to object-address.
> >
> >
> Actually it only says it should be unique, not never-changing. In
> particular,
> all it needs for eq? to grok it is uniqueness. I guess just returning
> the address
> ought to work, no?
It says "for the lifetime of this object".
Anyways, the goops code only uses the address for printing, so it
would safe to return the address. I suggest that the documentation be
changed to
"Return the address of OBJ as an integer. Note that this
address may change between runs due to garbage collection."
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen/
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-18 12:08 ` Han-Wen Nienhuys
@ 2002-07-19 3:59 ` Rob Browning
2002-07-19 9:39 ` Han-Wen
2002-07-19 22:58 ` Marius Vollmer
1 sibling, 1 reply; 18+ messages in thread
From: Rob Browning @ 2002-07-19 3:59 UTC (permalink / raw)
Cc: Miroslav Silovic, Marius Vollmer, guile-devel
Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
> Anyways, the goops code only uses the address for printing, so it
> would safe to return the address. I suggest that the documentation be
> changed to
>
> "Return the address of OBJ as an integer. Note that this
> address may change between runs due to garbage collection."
Alternately if we really need a unique value, and if it's only used
for printing -- couldn't we just use a good old fashioned integer
counter? What's the point of printing the address of the object if
it's only the transient address of the object, unless perhaps the
value's only intended for debugging?
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-19 3:59 ` Rob Browning
@ 2002-07-19 9:39 ` Han-Wen
2002-07-19 15:40 ` Rob Browning
0 siblings, 1 reply; 18+ messages in thread
From: Han-Wen @ 2002-07-19 9:39 UTC (permalink / raw)
Cc: Miroslav Silovic, Marius Vollmer, guile-devel
rlb@defaultvalue.org writes:
> Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
>
> > Anyways, the goops code only uses the address for printing, so it
> > would safe to return the address. I suggest that the documentation be
> > changed to
> >
> > "Return the address of OBJ as an integer. Note that this
> > address may change between runs due to garbage collection."
>
> Alternately if we really need a unique value, and if it's only used
> for printing -- couldn't we just use a good old fashioned integer
> counter? What's the point of printing the address of the object if
> it's only the transient address of the object, unless perhaps the
> value's only intended for debugging?
What do you mean by integer counter? You have to store a reference to
the object when object-address is first invoked on it; then you might
as well store the object in a list and simply mark it conservatively.
(and then you have to add support to maintain the list weakly --
argh).
The value is only intended for human consumption (i.e. debugging)
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-19 9:39 ` Han-Wen
@ 2002-07-19 15:40 ` Rob Browning
2002-07-19 19:07 ` Tom Lord
2002-07-19 21:07 ` Han-Wen Nienhuys
0 siblings, 2 replies; 18+ messages in thread
From: Rob Browning @ 2002-07-19 15:40 UTC (permalink / raw)
Cc: Miroslav Silovic, Marius Vollmer, guile-devel
Han-Wen <hanwen@cs.uu.nl> writes:
> What do you mean by integer counter?
A unique per-object value taken from a plain old integer sequence.
i.e. the first object is 1, the second is 2, etc.
> The value is only intended for human consumption (i.e. debugging)
OK, that's one thing I wasn't sure of, and given that, I wasn't sure
whether a unique number that's constant across the lifetime of the
object (an integer), or the address (which may change) would be more
useful. I suppose it depends on what type of debugging you're trying
to do, and of course, the address would be cheaper to provide.
Note though, that if there's not supposed to be a way to look up an
object by its object-address value, then you don't need to store the
values in a hash table mapping to objects or similar.
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-19 15:40 ` Rob Browning
@ 2002-07-19 19:07 ` Tom Lord
2002-07-19 21:07 ` Han-Wen Nienhuys
1 sibling, 0 replies; 18+ messages in thread
From: Tom Lord @ 2002-07-19 19:07 UTC (permalink / raw)
Cc: hanwen, miro, mvo, guile-devel
I think that assuming a bibop memory manager can solve the "stable
value assocated with possibly moving object" problem in some nice
ways.
-t
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-19 15:40 ` Rob Browning
2002-07-19 19:07 ` Tom Lord
@ 2002-07-19 21:07 ` Han-Wen Nienhuys
2002-07-19 21:32 ` Rob Browning
1 sibling, 1 reply; 18+ messages in thread
From: Han-Wen Nienhuys @ 2002-07-19 21:07 UTC (permalink / raw)
Cc: Miroslav Silovic, Marius Vollmer, guile-devel
rlb@defaultvalue.org writes:
> Han-Wen <hanwen@cs.uu.nl> writes:
>
> > What do you mean by integer counter?
>
> A unique per-object value taken from a plain old integer sequence.
> i.e. the first object is 1, the second is 2, etc.
The point is that the number should be associated with the object, and
you have to remember that association, since addresses might change
between any two calls of object-address.
If we don't have to keep an association, then ... well we could
return any random number (say, the outcome of rand() ) and the whole
procedure is pointless.
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen/
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-19 21:07 ` Han-Wen Nienhuys
@ 2002-07-19 21:32 ` Rob Browning
2002-07-19 22:33 ` Han-Wen
0 siblings, 1 reply; 18+ messages in thread
From: Rob Browning @ 2002-07-19 21:32 UTC (permalink / raw)
Cc: Miroslav Silovic, Marius Vollmer, guile-devel
Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
> The point is that the number should be associated with the object, and
> you have to remember that association, since addresses might change
> between any two calls of object-address.
>
> If we don't have to keep an association, then ... well we could
> return any random number (say, the outcome of rand() ) and the whole
> procedure is pointless.
Apparently I'm misunderstanding you or the issue.
Earlier I thought you posted that object-address's docs say that it's
supposed to return a value that's unique to the object, and I thought
you also said that that the returned value was only ever used for
display purposes (i.e. no one will ever say "give me the object
corresponding to address N").
If both of those bits are true, then all I was saying was that when
you create an object, you could assign it a unique integer (from a
counter) -- i.e. stick the integer into the object, and object-address
could just look in the object and return that integer whenever called.
Of course if object-address is infrequently used, this may be a
wasteful approach (storage-wise), but if the value isn't supposed to
change across the lifetime of the object (which is what the docs you
posted made it sound like initially, and what I was thinking about
when I responded initially), then it's a better idea than printing the
(transient) address.
Of course if the object-address docs are wrong, then that's a
different story.
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-19 21:32 ` Rob Browning
@ 2002-07-19 22:33 ` Han-Wen
2002-07-19 23:31 ` Rob Browning
0 siblings, 1 reply; 18+ messages in thread
From: Han-Wen @ 2002-07-19 22:33 UTC (permalink / raw)
Cc: guile-devel
rlb@defaultvalue.org writes:
> Earlier I thought you posted that object-address's docs say that it's
> supposed to return a value that's unique to the object, and I thought
> you also said that that the returned value was only ever used for
> display purposes (i.e. no one will ever say "give me the object
> corresponding to address N").
>
> If both of those bits are true, then all I was saying was that when
> you create an object, you could assign it a unique integer (from a
> counter) -- i.e. stick the integer into the object, and object-address
> could just look in the object and return that integer whenever called.
Most objects don't allow for places to insert extra
integers. object-address takes a general scheme object, and eg. in a
cons there is no room for an extra number.
> Of course if the object-address docs are wrong, then that's a
> different story.
Unless I'm mistaken, object-address is not standard Scheme, so we can
pretty much change the docs to suit our needs :)
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-19 22:33 ` Han-Wen
@ 2002-07-19 23:31 ` Rob Browning
0 siblings, 0 replies; 18+ messages in thread
From: Rob Browning @ 2002-07-19 23:31 UTC (permalink / raw)
Cc: guile-devel
Han-Wen <hanwen@cs.uu.nl> writes:
> Most objects don't allow for places to insert extra
> integers. object-address takes a general scheme object, and eg. in a
> cons there is no room for an extra number.
Ahh, OK. I did misunderdstand. I didn't realize this was for all
objects.
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-18 12:08 ` Han-Wen Nienhuys
2002-07-19 3:59 ` Rob Browning
@ 2002-07-19 22:58 ` Marius Vollmer
1 sibling, 0 replies; 18+ messages in thread
From: Marius Vollmer @ 2002-07-19 22:58 UTC (permalink / raw)
Cc: Miroslav Silovic, guile-devel
Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
> Anyways, the goops code only uses the address for printing, so it
> would safe to return the address. I suggest that the documentation be
> changed to
>
> "Return the address of OBJ as an integer. Note that this
> address may change between runs due to garbage collection."
I'd say it would be better to also change the name of the function so
that nobody is tricked by the changed semantics.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-17 23:12 ` Han-Wen
2002-07-18 12:08 ` Miroslav Silovic
@ 2002-07-18 16:00 ` Dirk Herrmann
2002-07-18 16:21 ` Han-Wen Nienhuys
2002-07-19 22:55 ` Marius Vollmer
2 siblings, 1 reply; 18+ messages in thread
From: Dirk Herrmann @ 2002-07-18 16:00 UTC (permalink / raw)
Cc: Marius Vollmer, guile-devel
On Thu, 18 Jul 2002, Han-Wen wrote:
> mvo@zagadka.ping.de writes:
> > Han-Wen <hanwen@cs.uu.nl> writes:
> >
> > > How is this supposed to portable to GenGC?
> > >
> > > SCM_DEFINE (scm_object_address, "object-address", 1, 0, 0,
> > > (SCM obj),
> > > "Return an integer that for the lifetime of @var{obj} is uniquely\n"
> > > "returned by this function for @var{obj}")
> > >
> > > This is used in some of the goops code -- should I retain it?
> >
> > It would be cool if you could fake it. It doesn't need to be the real
> > memory address of the object, just a unique integer.
>
> ?
>
> What if I can't? Memory cells are going to move around. I don't see a
> way to generate a unique number without making some kind of table for
> objects subjected to object-address.
>
> Btw, I can imagine that internal hash tables might use the address of
> a cell as a source for a hash index. Does that happen anywhere?
Look into hash.[ch]. scm_hashq seems to be what you think of.
Best regards,
Dirk Herrmann
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-18 16:00 ` Dirk Herrmann
@ 2002-07-18 16:21 ` Han-Wen Nienhuys
0 siblings, 0 replies; 18+ messages in thread
From: Han-Wen Nienhuys @ 2002-07-18 16:21 UTC (permalink / raw)
Cc: guile-devel
dirk@sallust.ida.ing.tu-bs.de writes:
> > What if I can't? Memory cells are going to move around. I don't see a
> > way to generate a unique number without making some kind of table for
> > objects subjected to object-address.
> >
> > Btw, I can imagine that internal hash tables might use the address of
> > a cell as a source for a hash index. Does that happen anywhere?
>
> Look into hash.[ch]. scm_hashq seems to be what you think of.
OK. In that case, how is this handled? Can we simply disallow plain
cells as hash keys? Oh wait scm_hasher doesn't use the adress of an
object. Good.
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen/
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: gen gc
2002-07-17 23:12 ` Han-Wen
2002-07-18 12:08 ` Miroslav Silovic
2002-07-18 16:00 ` Dirk Herrmann
@ 2002-07-19 22:55 ` Marius Vollmer
2002-07-20 8:06 ` Neil Jerram
2 siblings, 1 reply; 18+ messages in thread
From: Marius Vollmer @ 2002-07-19 22:55 UTC (permalink / raw)
Cc: guile-devel
Han-Wen <hanwen@cs.uu.nl> writes:
> mvo@zagadka.ping.de writes:
>
> > It would be cool if you could fake it. It doesn't need to be the real
> > memory address of the object, just a unique integer.
>
> What if I can't?
Then we can remove object-address. If people need something like it,
we can keep it, but with a different name and the warning that the
address of an object might change over its lifetime.
> Memory cells are going to move around. I don't see a way to generate
> a unique number without making some kind of table for objects
> subjected to object-address.
Yes. But for a deprecation period, this will be good enough, no?
> Btw, I can imagine that internal hash tables might use the address of
> a cell as a source for a hash index. Does that happen anywhere?
Yes, in scm_ihashq and scm_ihashv and maybe elsewhere. There are
techniques to deal with this, I believe...
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2002-07-20 8:06 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-17 21:59 gen gc Han-Wen
2002-07-17 22:54 ` Marius Vollmer
2002-07-17 23:12 ` Han-Wen
2002-07-18 12:08 ` Miroslav Silovic
2002-07-18 12:08 ` Han-Wen Nienhuys
2002-07-19 3:59 ` Rob Browning
2002-07-19 9:39 ` Han-Wen
2002-07-19 15:40 ` Rob Browning
2002-07-19 19:07 ` Tom Lord
2002-07-19 21:07 ` Han-Wen Nienhuys
2002-07-19 21:32 ` Rob Browning
2002-07-19 22:33 ` Han-Wen
2002-07-19 23:31 ` Rob Browning
2002-07-19 22:58 ` Marius Vollmer
2002-07-18 16:00 ` Dirk Herrmann
2002-07-18 16:21 ` Han-Wen Nienhuys
2002-07-19 22:55 ` Marius Vollmer
2002-07-20 8:06 ` Neil Jerram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).