Example #1
0
void irc_init_pstore_gen( struct IRC_Gen *gen )
{
  gen->heap = NULL;
  gen->unmapped = 2;
  gen->genNum = 7;
  gen->scanning = NULL;
  gen->whiteColorCode = 0;
  gen->blackColorCode = 1;
  gen->state = GSTATE_IDLE;
  gen->tracking_level = 0;

  gen->flip_hook = NULL;
  gen->flip_hook_info = NULL;
  gen->igp_hook = NULL;
  gen->igp_hook_info = NULL;

  initPtrList( &gen->regrayObjects );
  initPtrList( &gen->markedObjects );
  initPtrList( &gen->extraHeapPointers );

  /*
   *  These are used to keep track of pointers *into* the
   *  persistent heap, so that we can kick off 
   */

  gen->link = first_pstore_gen;
  first_pstore_gen = gen;
}
Example #2
0
void irc_pstore_gen_did_commit( struct IRC_Gen *gen )
{
  /* the pstore completed a commit operation, which means that 
   * everything in it is either a pointer to another object in
   * the store *or* a pointer to a pivot object.  In either case,
   * there are no more pointers such that the pstore contains
   * the only one.  That means we can empty out the list of
   * possible down pointers!
   */
  /* since we actually store in the rvalue's generation, and
     the write barrier is not active in cell (15,15), this list
     will always be empty.  We should be clearing the_arena's list
  */
extern IRC_Heap *gc_arena;

  assert( gen->extraHeapPointers.first == NULL );

  gen = &gc_arena->theGenerations[0];   /* XXX Experiment 2 */

  IRC_freePtrList( &gen->extraHeapPointers );
  initPtrList( &gen->extraHeapPointers );

  /*  Note that the GC could be in the middle of scanning the
   *  extraHeapPointers.  If we don't clear that out, it might
   *  scan garbage (either because the bucket gets reused
   *  or because an object containing an stored slot gets deallocated)
   */
  if (gen->state == GSTATE_XHEAP_SCAN) {
    gen->iterator.externals = NULL;
  }
}
Example #3
0
void CustomOrderedListEdit::slotEditButtonClicked()
{
    OListEditForm *d = new OListEditForm( this );
    d->setWindowTitle( _FU8( m_custom->label ) );
    initPtrList();

    /*
     * Adding Enabled Items
     */
    foreach( const struct uim_custom_choice *item, m_itemList )
    {
        d->addCheckItem( true, _FU8(item->label) );
    }
Example #4
0
void CustomOrderedListEdit::setDefault()
{
    /* free old items */
    int num = 0;
    for( num = 0; m_custom->value->as_olist[num]; num++ )
        ;

    for( int i = 0; i < num; i++ )
    {
        free( m_custom->value->as_olist[i]->symbol );
        free( m_custom->value->as_olist[i]->label );
        free( m_custom->value->as_olist[i]->desc );
        free( m_custom->value->as_olist[i] );
    }

    /* copy default_value to value */
    int default_num = 0;
    for( default_num = 0; m_custom->default_value->as_olist[default_num]; default_num++ )
        ;

    m_custom->value->as_olist = (struct uim_custom_choice **)realloc( m_custom->value->as_olist,
                                                                      sizeof(struct uim_custom_choice *) * (default_num + 1) );

    for( int i = 0; i < default_num; i++ )
    {
        struct uim_custom_choice *default_item = m_custom->default_value->as_olist[i];
        struct uim_custom_choice *item = (struct uim_custom_choice *)malloc(sizeof(struct uim_custom_choice));

        item->symbol = default_item->symbol ? strdup(default_item->symbol) : 0;
        item->label  = default_item->label  ? strdup(default_item->label)  : 0;
        item->desc   = default_item->desc   ? strdup(default_item->desc)   : 0;

        m_custom->value->as_olist[i] = item;
    }
    m_custom->value->as_olist[default_num] = 0; /* NULL-terminated */

    setCustom( m_custom );
    initPtrList();
    update();
}
Example #5
0
void CustomOrderedListEdit::slotEditButtonClicked()
{
    OListEditForm *d = new OListEditForm( this );
    initPtrList();

    /*
     * Adding Enabled Items
     */
    for( struct uim_custom_choice *item = m_itemList.first();
         item;
         item = m_itemList.next() )
    {
        d->addCheckItem( true, _FU8(item->label) );
    }
    /*
     * Adding Disabled Items
     */
    for( struct uim_custom_choice *valid_item = m_validItemList.first();
         valid_item;
         valid_item = m_validItemList.next() )
    {
        /* Exclude Enabled Item */
        bool isActive = false;
        for( struct uim_custom_choice *item = m_itemList.first();
             item;
             item = m_itemList.next() )
        {
            if( QString::compare( valid_item->symbol, item->symbol ) == 0 )
            {
                isActive = true;
                break;
            }
        }

        if( isActive == false )
        {
            d->addCheckItem( false, _FU8(valid_item->label) );
        }
    }

    /* Exec Dialog */
    if( d->exec() == OListEditForm::Accepted )
    {
        /* search active item's ptr, realloc it, and store in activeItemList */
        QPtrList<struct uim_custom_choice> activeItemList;
        activeItemList.setAutoDelete( false );

        QStringList activeItemLabelList = d->activeItemLabels();
        for( unsigned int i = 0; i < activeItemLabelList.count(); i++ )
        {
            struct uim_custom_choice *item = NULL;
            int j = 0;
            for( item = m_custom->range->as_olist.valid_items[0], j = 0;
                 item;
                 item = m_custom->range->as_olist.valid_items[++j] )
            {
                if( QString::compare( activeItemLabelList[i], _FU8(item->label) ) == 0 )
                {
                    /* allocate new struct because we will free the old struct */
                    struct uim_custom_choice *activeItem = (struct uim_custom_choice *)malloc(sizeof(struct uim_custom_choice));
                    activeItem->symbol = item->symbol ? strdup(item->symbol) : NULL;
                    activeItem->label  = item->label  ? strdup(item->label)  : NULL;
                    activeItem->desc   = item->desc   ? strdup(item->desc)   : NULL;
                    activeItemList.append( activeItem );
                    break;
                }
            }
        }

        /* free old items */
        for( unsigned int i = 0; i < m_itemList.count(); i++ )
        {
            free( m_custom->value->as_olist[i]->symbol );
            free( m_custom->value->as_olist[i]->label );
            free( m_custom->value->as_olist[i]->desc );
            free( m_custom->value->as_olist[i] );
        }

        /* create null-terminated new olist */
        m_custom->value->as_olist = (struct uim_custom_choice **)realloc( m_custom->value->as_olist,
                                                                         sizeof(struct uim_custom_choice *) * (activeItemList.count() + 1) );
        for( unsigned int i = 0; i < activeItemList.count(); i++ )
        {
            m_custom->value->as_olist[i] = activeItemList.at(i);
        }
        m_custom->value->as_olist[activeItemList.count()] = NULL;

        /* save */
        setCustom( m_custom );

        /* reload */
        update();
    }

    delete d;
}
Example #6
0
void irc_init_gen( IRC_Heap *owner, 
		   unsigned genNum,
		   struct IRC_Gen *gen,
		   IRC_SizeClass **logicalSCs )
{
IRC_SizeClass *(temp[NUM_LOGICAL_SIZE_CLASSES]);
IRC_SizeClass **lsc, *psc;
int i;
UINT_32 lim;

    gen->heap = owner;
    gen->unmapped = 0;
    gen->scanning = NULL;
    gen->genNum = genNum;
    gen->whiteColorCode = 0;
    gen->blackColorCode = 1;
    gen->state = GSTATE_IDLE;
    gen->tracking_level = 0;
    gen->link = NULL;
    gen->flip_hook = NULL;
    gen->flip_hook_info = NULL;
    gen->igp_hook = NULL;
    gen->igp_hook_info = NULL;

    initPtrList( &gen->regrayObjects );
    initPtrList( &gen->markedObjects );
    initPtrList( &gen->extraHeapPointers );

    lsc = logicalSCs ? logicalSCs : temp;
	
    psc = gen->theSizeClasses;    /* physical size classes */

    /* fine size class [0] is aliased to size class [1] */
    *lsc++ = psc;

    lim = 0;
    for (i=0; i<NUM_FINE_SIZE_CLASSES-1; i++)
    {
	*lsc++ = psc;
	lim += FINE_SIZE_CLASS_RESOLUTION;
	initSizeClass( gen, psc, 0, lim );
	psc++;
    }
    for (i=0; i<NUM_COARSE_SIZE_CLASSES; i++)
    {
	*lsc++ = psc;
	lim += COARSE_SIZE_CLASS_RESOLUTION;
	initSizeClass( gen, psc, 0, lim );
	psc++;
    }
    *lsc++ = psc;
    initSizeClass( gen, psc, 1, 0xFFFFFFFF - sizeof(IRC_Header) );

    /* initialize the traversal work table */
    
    /* initially, only need to do work on encountering
       a white object in our own generation
    */
    for (i=0; i<16; i++)
	gen->traversalWork[i] = 0;
    gen->traversalWork[genNum*2] = 1;

    /* or when encountering a WHITE object in a pstore */
    gen->traversalWork[7*2+0] = 1;
}