Main Page   Class Hierarchy   Compound List   File List   Header Files   Compound Members   File Members  

preserve.h

This is the verbatim text of the preserve.h include file.
/* Sun-$Revision: 23.2 $ */

/* Copyright 1992-9 Sun Microsystems, Inc. and Stanford University.
   See the LICENSE file for license information. */

# pragma interface

// preserved objects are used to protect oops (or objects containing oops)
// against garbage collections that happen during execution of some C code
// (GCs may happen when C code calls Self)

struct preservedVmObj: StackObj {
  preservedVmObj()  { currentProcess->preserve(this); }
  ~preservedVmObj() { currentProcess->un_preserve(this); }
  // virtual void oops_do(oopsDoFn f) = 0; declared in base class VMObj
};

struct preserved: preservedVmObj {
  oop value;
  
  preserved(oop v) { value = v; }
  void oops_do(oopsDoFn f) { OOPS_DO_TEMPLATE(&value,f) }
};

struct preservedObj: preservedVmObj {
  VMObj* value;
  
  preservedObj(VMObj* v) { value = v; }
  void oops_do(oopsDoFn f) { if (value) value->oops_do(f); }
};


struct preservedArray: preservedVmObj {
  oop* oops;
  int32 length;

  preservedArray(oop* p, int32 n) { oops = p; length = n; }
  void oops_do(oopsDoFn f) {
    for ( int32 i = 0;  i < length;  ++i) {
      OOPS_DO_TEMPLATE(&oops[i],f) }}
};

Generated at Tue Jun 27 12:16:27 2000 for SelfVM by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999