Sat Feb 26 08:35:31 GMT+2 2000

I want to get persistence working again. This will mean tracing step by step the actions taken to make an object persistent and the steps to unpersist it.

We start with PStore.nativeSetRootObject which sets the root of the Store to a new PStore object. 

-*- nativeSetRootObject then calls
 -*- RPOT_PromoteObject(obj) 
     This checks that the object isn't already persistent
     Then we see if it has a persistent entry for its type
      if not then the type->persIndex is set to a new Object on the store which is just the name of the type
       It then writes this "string" object
       
      Now we set the pstType to the type->persIndex field.
      Now call NewObject and save the pid it returns
       -*- STORE_NewObject( int32 size ) 
      Then write the object data to the store (note that the fields are not yet persisted)
       -*- STORE_UpdateObject( pid, ref ) 
      Add the entry to the RPOT so we know this is a persistent object 
       -*- RPOT_Add( pid, ref ) 
       Set it's pid
      ref->pid = pid
      Set the type back to the runtime type (so we can continue working)
      ref->pstType = type
      return the pid
  Now we're back in nativeSet...
  We just do STORE_SetRootPID(pid).

  Then the java code goes and does a few getRoot and addRoot calls.

  Finally we call PStore.stabiliseAll
  Which does
  -*- RPOT_StabiliseAll();
      When go to each i in TABLESIZE
      if( RPOT_table[i].pid )	
       -*- RPOT_Stabilise that .la
        If the obj does not have any PERSIST_Dirty flags and the pid is nonzero then return
	else
	set the flag to GARBAGE_PERSISTENT
	clear the dirty mask (so that if one of the objects fields points to it we don't go in circles)
	if it is an object
	 if it has vars
	  iterate through all types up to base type
	   for each instance slot
	    check the type of the slot
	     if its an array or object
	      if nonnull
	       if it is a pid 
	        continue
	       else
	        call RPOT_Stabilise on DEREF(refH)
		update the instance entry to contain the pid
		
	else if it's an array
	 if it's not an array of arrays or array of objects then return
	 for each element
	 if nonnull
	  if pid, continue
	  else
	  RPOT_Stabilise( DEREF(refH));
	 Update the element with the pid
      go through the next links

      if(o->pid)
      Now finally call UpdateObject( o->pid, o);
      else
      PromoteObject(o);

     and back to StabiliseAll
     which just returns

And finally we have STORE_CloseStore being called.

Now let's loot at our simple test case:

Here we see the nativeSetRoot creating a "plava/PStore" class entry at pid -8. Then as the PStore is promoted it gets pid -24.

Next we start stabilising objects, 


