DTREG_OBJ* DtregObj( // LOCATE RW_DTREG_OBJ SYMBOL FN_CTL* fctl ) // - current function information { DTREG_OBJ* curr; // - current entry DTREG_OBJ* obj; // - entry for function obj = NULL; RingIterBeg( ringDtregObj, curr ) { if( ! curr->in_use ) { obj = curr; break; } } RingIterEnd( curr ) if( obj == NULL ) { obj = RingCarveAlloc( carveDTREG_OBJ, &ringDtregObj ); obj->cg_sym = NULL; } if( ! DtmTabular( fctl ) ) { obj->sym = NULL; } else { if( obj->cg_sym == NULL ) { obj->cg_sym = CgVarRw( 3 * CgbkInfo.size_data_ptr, SC_AUTO ); AutoRelRegister( obj->cg_sym, &obj->offset ); } obj->sym = obj->cg_sym; } obj->in_use = TRUE; return obj; }
static cg_name genCtorFlagClr( // CLEAR CTOR FLAGGING cg_name expr, // - current expression cg_type type, // - expression type SE* se ) // - state entry for ctor'ed object { FN_CTL* fctl = FnCtlTop(); // - function information CTOR_FLAG_SET* cfs; // - call-back data if( DtmTabular( fctl ) ) { cfs = CarveAlloc( carve_ctor_flag ); cfs->se = se; expr = CgComma( ctorFlagSet( fctl, O_AND, &cfs->ph_clr ) , expr , type ); expr = CgCallBackRight( expr, &callBackCtorFlag, cfs, type ); } return expr; }
SE* DtorForDelBeg( // DTORING AREA TO BE DELETED: start FN_CTL* fctl, // - function information target_size_t elem_size, // - size of one element in area unsigned dlt1, // - entry type when one arg unsigned dlt2, // - entry type when two args SYMBOL op_del ) // - operator delete to be used { SE* se_dlt; // - entry allocated SYMBOL var; // - var containing address of delete area cg_name top_expr; // - top expression cg_type top_type; // - type of top expression cg_name emit; // - expression for state update patch_handle patch; // - patch handle for area if( DtmTabular( fctl ) ) { if( 2 == SymFuncArgList( op_del )->num_args ) { se_dlt = SeAlloc( dlt2 ); se_dlt->del_2_array.size = elem_size; } else { se_dlt = SeAlloc( dlt1 ); } se_dlt->del_1_array.op_del = op_del; var = CgVarRw( TY_POINTER, SC_AUTO ); if( se_dlt->base.gen ) { AutoRelRegister( var, &se_dlt->del_1_array.offset ); } top_expr = CgExprPopType( &top_type ); top_expr = CGLVAssign( CgSymbol( var ), top_expr, top_type ); top_expr = CgFetchType( top_expr, top_type ); emit = emitPatch( &patch ); top_expr = emitPatchCallBack( top_expr , emit , top_type , &patchForDtorDelBeg , patch , se_dlt ); CgExprPush( top_expr, top_type ); DbgSetState( "patchForDtorDelBeg", se_dlt ); } else { se_dlt = NULL; } return se_dlt; }
void DtorForDelEnd( // DTORING AREA TO BE DELETED: end FN_CTL* fctl, // - function information SE* se_dlt ) // - entry { cg_name emit; // - expression for state update patch_handle patch; // - patch handle for area cg_name top_expr; // - top expression cg_type top_type; // - type of top expression if( DtmTabular( fctl ) ) { DbgVerify( se_dlt != NULL, "DtorForDelEnd -- NULL entry" ); emit = emitPatch( &patch ); top_expr = CgExprPopType( &top_type ); top_expr = emitPatchCallBack( top_expr , emit , top_type , &patchForDtorDelEnd , patch , se_dlt ); CgExprPush( top_expr, top_type ); } }