- Timestamp:
- Apr 21, 2021, 3:44:58 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 578c09a
- Parents:
- 7711064
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r7711064 rb583113 414 414 if ( type_decl && isDestructorFor( decl, type_decl ) ) 415 415 dtor_decl = decl; 416 else if ( vtable_name.empty() ) 417 ; 418 else if( !decl->has_body() ) 416 else if ( vtable_name.empty() || !decl->has_body() ) 419 417 ; 420 418 else if ( auto param = isMainFor( decl, cast_target ) ) { … … 428 426 std::list< Expression * > poly_args = { new TypeExpr( struct_type->clone() ) }; 429 427 ObjectDecl * vtable_object = Virtual::makeVtableInstance( 428 "_default_vtable_object_declaration", 430 429 vtable_decl->makeInst( poly_args ), struct_type, nullptr ); 431 430 declsToAddAfter.push_back( vtable_object ); 431 declsToAddAfter.push_back( 432 new ObjectDecl( 433 Virtual::concurrentDefaultVTableName(), 434 Type::Const, 435 LinkageSpec::Cforall, 436 /* bitfieldWidth */ nullptr, 437 new ReferenceType( Type::Const, vtable_object->type->clone() ), 438 new SingleInit( new VariableExpr( vtable_object ) ) 439 ) 440 ); 432 441 declsToAddAfter.push_back( Virtual::makeGetExceptionFunction( 433 442 vtable_object, except_decl->makeInst( std::move( poly_args ) ) … … 488 497 except_decl->makeInst( poly_args ) 489 498 ) ); 490 declsToAddBefore.push_back( Virtual::makeVtableForward( 491 vtable_decl->makeInst( move( poly_args ) ) ) ); 499 ObjectDecl * vtable_object = Virtual::makeVtableForward( 500 "_default_vtable_object_declaration", 501 vtable_decl->makeInst( move( poly_args ) ) ); 502 declsToAddBefore.push_back( vtable_object ); 503 declsToAddAfter.push_back( 504 new ObjectDecl( 505 Virtual::concurrentDefaultVTableName(), 506 Type::Const, 507 LinkageSpec::Cforall, 508 /* bitfieldWidth */ nullptr, 509 new ReferenceType( Type::Const, vtable_object->type->clone() ), 510 /* init */ nullptr 511 ) 512 ); 492 513 } 493 514 -
src/Virtual/Tables.cc
r7711064 rb583113 10 10 // Created On : Mon Aug 31 11:11:00 2020 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Apr 8 15:51:00 202113 // Update Count : 112 // Last Modified On : Wed Apr 21 15:36:00 2021 13 // Update Count : 2 14 14 // 15 15 … … 50 50 } 51 51 52 std::string concurrentDefaultVTableName() { 53 return "_default_vtable"; 54 } 55 52 56 bool isVTableInstanceName( std::string const & name ) { 53 57 // There are some delicate length calculations here. … … 57 61 58 62 static ObjectDecl * makeVtableDeclaration( 63 std::string const & name, 59 64 StructInstType * type, Initializer * init ) { 60 std::string const & name = instanceName( type->name );61 65 Type::StorageClasses storage = noStorageClasses; 62 66 if ( nullptr == init ) { … … 73 77 } 74 78 75 ObjectDecl * makeVtableForward( StructInstType * type ) {79 ObjectDecl * makeVtableForward( std::string const & name, StructInstType * type ) { 76 80 assert( type ); 77 return makeVtableDeclaration( type, nullptr );81 return makeVtableDeclaration( name, type, nullptr ); 78 82 } 79 83 80 84 ObjectDecl * makeVtableInstance( 81 StructInstType * vtableType, Type * objectType, Initializer * init ) { 85 std::string const & name, StructInstType * vtableType, 86 Type * objectType, Initializer * init ) { 82 87 assert( vtableType ); 83 88 assert( objectType ); … … 115 120 assert(false); 116 121 } 117 return makeVtableDeclaration( vtableType, init );122 return makeVtableDeclaration( name, vtableType, init ); 118 123 } 119 124 … … 167 172 } 168 173 169 ObjectDecl * makeTypeIdForward() {170 return nullptr;171 }172 173 174 Attribute * linkonce( const std::string & subsection ) { 174 175 const std::string section = ".gnu.linkonce." + subsection; -
src/Virtual/Tables.h
r7711064 rb583113 10 10 // Created On : Mon Aug 31 11:07:00 2020 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Apr 8 15:55:00 202113 // Update Count : 112 // Last Modified On : Wed Apr 21 10:30:00 2021 13 // Update Count : 2 14 14 // 15 15 … … 27 27 std::string instanceName( std::string const & vtable_name ); 28 28 std::string vtableInstanceName( std::string const & type_name ); 29 std::string concurrentDefaultVTableName(); 29 30 bool isVTableInstanceName( std::string const & name ); 30 31 31 ObjectDecl * makeVtableForward( StructInstType * vtableType ); 32 ObjectDecl * makeVtableForward( 33 std::string const & name, StructInstType * vtableType ); 32 34 /* Create a forward declaration of a vtable of the given type. 33 35 * vtableType node is consumed. 34 36 */ 35 37 36 ObjectDecl * makeVtableInstance( StructInstType * vtableType, Type * objectType, 38 ObjectDecl * makeVtableInstance( 39 std::string const & name, 40 StructInstType * vtableType, Type * objectType, 37 41 Initializer * init = nullptr ); 38 42 /* Create an initialized definition of a vtable.
Note: See TracChangeset
for help on using the changeset viewer.