示例#1
0
static THROW_RO *throwRoGet(    // GET THROW R/O BLOCK
    TYPE type )                 // - type being thrown
{
    THROW_RO *srch;             // - search R/O block for symbol
    THROW_RO *ro;               // - R/O block for symbol
    SYMBOL sym;                 // - symbol for throw object
    THROW_CNV_CTL ctl;          // - control area
    target_offset_t offset;     // - offset ( not used )

    type = TypeCanonicalThr( type );
    ro = NULL;
    RingIterBeg( ring_throw_ro, srch ) {
        if( TypesIdentical( srch->sig->type, type ) ) {
            ro = srch;
            break;
        }
    } RingIterEnd( srch );
    if( ro == NULL ) {
        ro = RingCarveAlloc( carveTHROW_RO, &ring_throw_ro );
        ro->sig = BeTypeSignature( type );
        ro->emitted = false;
        sym = CgVarRo( CgbkInfo.size_offset + sizeOfThrowCnv() * ThrowCnvInit( &ctl, type ),
                     SC_PUBLIC, CppNameThrowRo( type ) );
        ro->sym = sym;
        for( ; ; ) {
            type = ThrowCnvType( &ctl, &offset );
            if( type == NULL )
                break;
            BeTypeSignature( type );
        }
        ThrowCnvFini( &ctl );
    }
    return( ro );
}
示例#2
0
static bool throwCnvFront(      // GET FRONT-END INFO. FOR THROW TYPE
    TYPE type,                  // - type to be thrown
    PTREE expr )                // - expression for errors
{
    bool ret;                   // - return value
    THROW_CNV_CTL ctl;          // - control information

    PTreeExtractLocn( expr, &ctl.err_locn );
    ThrowCnvInit( &ctl, type );
    ret = ! ctl.error_occurred;
    ThrowCnvFini( &ctl );
    return ret;
}
示例#3
0
void ThrowRoGen(                // GENERATE A THROW R/O BLOCK
    void )
{
    THROW_RO *ro;               // - R/O block for symbol
    segment_id old_seg;         // - old segment
    TYPE type;                  // - type being converted
    THROW_CNV_CTL ctl;          // - control for conversions
    target_offset_t offset;     // - offset within class

    RingIterBeg( ring_throw_ro, ro ) {
        if( ! ro->emitted ) {
            ro->emitted = true;
            old_seg = DgSetSegSym( ro->sym );
            CgBackGenLabelInternal( ro->sym );
            offset = ThrowCnvInit( &ctl, ro->sig->type );
            DbgVerify( ! ctl.error_occurred
                     , "cgGenThrowRo -- failure in ThrowCnvInit" );
#ifndef NDEBUG
            if( PragDbgToggle.dump_stab ) {
                printf( "ThrowRo[%p] offset=%p sig=%x\n"
                      , ro
                      , ro->sig
                      , offset );
            }
#endif
            DgOffset( offset );
            for( ; ; ) {
                type = ThrowCnvType( &ctl, &offset );
                if( type == NULL )
                    break;
                cgGenThrowCnv( type, offset );
            }
            ThrowCnvFini( &ctl );
            BESetSeg( old_seg );
        }
    } RingIterEnd( ro );
}