Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can systemdict contain userdict?

53 views
Skip to first unread message

luser- -droog

unread,
Oct 5, 2013, 11:34:46 PM10/5/13
to
How can systemdict contain userdict?
Composite objects in global memory are not permitted to contain references to objects in local memory. How then is systemdict able to contain references to userdict, errordict and $error?

The advantage of this restriction are clear when you consider that garbage collection can be performed separately for local and global VMs. A collection of local VM can be performed more cheaply since only local VM needs to be scanned. A collection of global VM, on the other hand, must scan both global and local VMs.

userdict is probably fine, since the stacks are part of the root set. But how to keep $error from being garbage collected when it exists in local VM, but its reference is in global VM (in systemdict) and therefore not encountered during a scan of local VM roots?

luser- -droog

unread,
Oct 7, 2013, 1:43:19 AM10/7/13
to
The workaround I've found is to suppress the invalidaccess error while installing these local objects into systemdict, and keep dups in userdict for the collector to find.

luser- -droog

unread,
Oct 7, 2013, 7:11:33 AM10/7/13
to
I suppose very few contributors here have had to worry about this (yet). Bugbear and Aandi, probably. Helmar, maybe. Ken, possibly, I don't know whether he works on
the garbage collector.

But I hope others get there!

I want to start answering some questions about garbage collection, instead of endlessly asking them. :)

ken

unread,
Oct 7, 2013, 12:22:16 PM10/7/13
to
In article <4e5f7637-9dc9-446d...@googlegroups.com>,
mij...@yahoo.com says...

> I suppose very few contributors here have had to worry about this
(yet). Bugbear and Aandi, probably. Helmar, maybe. Ken, possibly, I
don't know whether he works on
> the garbage collector.

I treat the Ghostscript garbage collector like a particularly nasty
variety of plague, and Jaws doesn't do garbage collection, so that was
never an issue.

luser- -droog

unread,
Oct 8, 2013, 8:35:44 PM10/8/13
to
On Monday, October 7, 2013 12:43:19 AM UTC-5, luser- -droog wrote:
Or, maybe this is the place to use name-chains!
systemdict /userdict /localuserdict cvx put
where localuserdict is the name in userdict for itself.
And similarly with localerrordict and local$error.

This should be user-transparent so long as access to
userdict is always by autoloading rather than `load`ing.

Symbolic links to span memory banks.

luser- -droog

unread,
Oct 21, 2013, 12:58:51 AM10/21/13
to
On Saturday, October 5, 2013 10:34:46 PM UTC-5, luser- -droog wrote:
PLRM 3ed, p 66:

Note: systemdict, a global dictionary, contains several
entries whose values are local dictionaries, such as
userdict and $error. This is an exception to the normal
rule, described in Section 3.7.2, “Local and Global VM,”
that prohibits objects in global VM from referring to
objects in local VM.

So, yes it's a straight exception to the rule.

And for the rest, ya gotta do what you gotta do!
0 new messages