module: internal
synopsis: Functions called from the debugger.
author: Paul Howard
Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
All rights reserved.
License: Functional Objects Library Public License Version 1.0
Dual-license: GNU Lesser General Public License
Warranty: Distributed WITHOUT WARRANTY OF ANY KIND
// ********************** Remote Object Registration *********************
// The idea behind this is as follows:
// Any dylan values (ie pointers) that become known to the debugger while
// the target is stopped can only be considered valid while the target
// _remains_ stopped. In the presence of a relocating garbage collector,
// there is every chance that a pointer will fall out of date while the
// application runs.
// The debugger may occasionally require a persistent handle on an object,
// via which the object's current value can always be obtained. In
// debugger terminology, this is called "remotely registering" (or
// sometimes "tracking") the object.
// Remote object registration can be "strong" or "weak". An object that
// is strongly registered continues to be tracked even when the target
// itself ceases to reference it. A weakly registered object can be
// reclaimed by the garbage collector if it not otherwise referenced
// by the target. To implement this, the SPY contains two dylan tables,
// one strong and one weak.
// The debugger registers objects by remote calling functions in the SPY,
// which install the objects into the relevant table, and return integer
// keys. The keys, being integers, remain valid through any amount of
// garbage collection work. And, since the objects are stored in dylan
// tables, the memory manager will keep their references up to date.
///// *SPY-STRONGLY-REGISTERED-OBJECTS*
// The table of objects that are being tracked by the debugger.
define constant *spy-strongly-registered-objects* ::
= make(
);
///// *SPY-WEAKLY-REGISTERED-OBJECTS*
// The table of objects that are being weakly tracked by the debugger.
define constant *spy-weakly-registered-objects* ::
= make(
);
///// *SPY-GLOBAL-REGISTRATION-COOKIE*
// Is returned as the handle on a registered object. Incremented each
// time an object is registered, either strongly or weakly. Since this
// just ticks up and up and up, there is an implementational limit
// on the number of objects that can be tracked. However, this limit
// should be far and away above the number of registrations that will
// ever be performed in practice. I think we are justified in completely
// ignoring this limit.
define variable *spy-global-registration-cookie* :: = 0;
///// SPY-REGISTER-REMOTE-OBJECT
// Adds an object into the table of strongly tracked objects. Returns
// the integer key.
define method spy-register-remote-object (x ::