예제 #1
0
파일: savetrav.c 프로젝트: Fuhuiang/rscheme
static obj assign_queue_names( SaveQueue *q, obj name )
{
  UINT_32 i, n = q->count;
  struct queue_entry *p;

  for (i=0, p=q->contents; i<n; i++, p++)
    {
      /* if it's in a queue, it should have pob_clas ZERO */
      assert( EQ(PTR_TO_HDRPTR(p->thing)->pob_class,ZERO) );
      PTR_TO_HDRPTR(p->thing)->pob_class = name;
      name = NEXT_NAME(name);
    }
  return name;
}
예제 #2
0
파일: savetrav.c 프로젝트: Fuhuiang/rscheme
static void cleanup_queued_objects( SaveQueue *q )
{
  UINT_32 i, n = q->count;
  struct queue_entry *p;

  for (i=0, p=q->contents; i<n; i++, p++)
    PTR_TO_HDRPTR(p->thing)->pob_class = p->orig_class;
}
예제 #3
0
파일: savetrav.c 프로젝트: Fuhuiang/rscheme
static obj *setup_reference_objects( obj ref_vec )
{
  UINT_32 i, n = SIZEOF_PTR(ref_vec) / SLOT(1);
  obj *saved_class;

  if (n == 0)
    return NULL;

  saved_class = (obj *)malloc( n * sizeof(obj) );
  for (i=0; i<n; i++)
    {
      obj ref_item = gvec_ref( ref_vec, SLOT(i) );
      /*printf( "REF item %08x\n", VAL(ref_item) ); */
      saved_class[i] = PTR_TO_HDRPTR(ref_item)->pob_class;
      PTR_TO_HDRPTR(ref_item)->pob_class = int2fx(1);
    }
  return saved_class;
}
예제 #4
0
파일: savetrav.c 프로젝트: Fuhuiang/rscheme
static void init_rplc( void *q, obj h, obj k, obj v )
{
  assert( OBJ_ISA_PTR(k) );
  assert( OBJ_ISA_PTR(v) );
  assert( OBJ_ISA_PTR(CLASSOF_PTR(k)) );

  hi_enqueue_item( (SaveQueue *)q, k );
  PTR_TO_HDRPTR(k)->pob_class = OBJ( VAL(v) - POINTER_TAG + IMMOB_TAG );
}
예제 #5
0
파일: savewrit.c 프로젝트: bitwize/rscheme
static _rs_inline obj unswizzle( obj item )
{
  if (OBJ_ISA_PTR(item))
    {
      obj swz = PTR_TO_HDRPTR(replace_ptr(item))->pob_class;
      assert( OBJ_ISA_PTR(swz) 
	      && ((VAL(swz)>>PRIMARY_TAG_SIZE) < known_num_objects) );
      return swz;
    }
  else
    {
      return item;
예제 #6
0
파일: savetrav.c 프로젝트: Fuhuiang/rscheme
static void cleanup_reference_objects( obj ref_vec, 
				       obj *saved_class )
{
  UINT_32 i, n = SIZEOF_PTR(ref_vec) / SLOT(1);
 
  if (n == 0)
    return;

  for (i=0; i<n; i++)
    {
      obj ref_item = gvec_ref( ref_vec, SLOT(i) );
      PTR_TO_HDRPTR(ref_item)->pob_class = saved_class[i];
    }
}
예제 #7
0
파일: savetrav.c 프로젝트: Fuhuiang/rscheme
static obj assign_ref_queue_names( SaveQueue *q, obj name )
{
  UINT_32 i, n = q->count;
  struct queue_entry *p;

  for (i=0, p=q->contents; i<n; i++, p++)
    {
      if (OBJ_ISA_PTR(p->thing))
	{
	  /* if it's in a queue, it should have pob_clas ZERO
	   * (except if it's not a PTR, that is)
	   */
	  assert( EQ(PTR_TO_HDRPTR(p->thing)->pob_class,ZERO) );
	  PTR_TO_HDRPTR(p->thing)->pob_class = name;
	}
      else
	{
	  struct part_descr *pd = OBJ_TO_RAW_PTR(p->thing);
	  pd->unswizzled_as = VAL(name);
	}
      name = NEXT_NAME(name);
    }
  return name;
}
예제 #8
0
파일: savetrav.c 프로젝트: Fuhuiang/rscheme
static _rs_inline void spot_object( obj thing )
{
POBHeader *p;

    if (OBJ_ISA_PTR(thing))
    {
      thing = replace_ptr(thing);

      assert( OBJ_ISA_PTR(thing) );

      p = (POBHeader *)PTR_TO_HDRPTR(thing);
      if (!EQ(p->pob_class,ZERO))
	spot_new_object(thing);
    }
}
예제 #9
0
파일: savetrav.c 프로젝트: Fuhuiang/rscheme
static void spot_new_object( obj thing )
{
POBHeader *p =(POBHeader *)PTR_TO_HDRPTR(thing);
obj the_class;
SaveQueue *q;

    the_class = p->pob_class;
    if (EQ(the_class,int2fx(1)))
    {
      q = &used_refs;
      /*printf( "spot REF %08x\n", VAL(thing) );*/
    }
    else 
    {
	/* a normal heap object that hasn't been spotted yet */
	obj rplc;
	int imode;

	assert( OBJ_ISA_PTR(the_class) );

	rplc = replace_ptr(the_class);
	
	imode = class_image_mode( rplc );
	/*printf( "spot NORMAL[%d] %08x\n", imode, VAL(thing) );*/
	if (imode < 0 || imode >= NUM_CLASS_MODES)
	{
	    fprintf( stderr, "Warning: Class %s has illegal image-mode = %d\n",
			symbol_text( class_name( rplc ) ),
			imode );
	    imode = 0;
	}
	q = &image_modes[imode].queue;
    }

    /* insert us in the appropriate queue */

    hi_enqueue_item( q, thing );
    p->pob_class = ZERO;
}