The TargetRTS source code
changes are listed below, in relation to the fixes for:
1.
PK46728; RATLC00556753 - Model may abort execution
with error message "deliver(): Invalid signal"
PK46728;
RATLC00556753 - Model may abort execution with error message
"deliver(): Invalid signal"
This fix copies data to a
non-critical section efficiently allowing the mutex to be available for
any higher priority thread
much more quickly.
Note: Addition or modifications are highlighted in Pink and deletions are highlighted in Red
1)
$ROSERT_HOME\C++\TargetRTS\include\RTActor.h
NEW |
OLD |
. . . void initializeAll( void ); int removeImport(
RTActorRef *, RTController * initiator ); void removeAllImports(
RTController * initiator ); int _followIn( RTBindingEnd & end, int portId, int repIndex, RTActorRef * importer ); int _followOut( RTBindingEnd & end, int portId, int repIndex ); void _unbind( RTActorRef *
importer ,RTController* initiator); virtual void _predestroy( void ); . . . |
. . . void initializeAll( void ); int removeImport(
RTActorRef * ); void removeAllImports( void
); int _followIn( RTBindingEnd & end, int portId, int repIndex, RTActorRef * importer ); int _followOut(
RTBindingEnd & end, int portId, int repIndex ); void _unbind( RTActorRef *
importer = 0 ); virtual
void _predestroy( void ); . . . |
2)
$ROSERT_HOME\C++\TargetRTS\include\RTActorref.h
|
NEW |
OLD |
. . . void deport( void ); int deport( RTActor * ); int deport( RTActor *,
RTImportList *,RTController * initiator
); RTS_INLINE int isFixed( void ) const; . . . |
. . . void deport( void ); int deport( RTActor * ); int deport( RTActor *, RTImportList * ); RTS_INLINE int isFixed( void ) const; . . . |
3)
$ROSERT_HOME\C++\ TargetRTS\src\include\RTRelayPort.h
NEW |
OLD |
#ifndef
__RTRelayPort_h__ #define
__RTRelayPort_h__ included #ifdef
PRAGMA #pragma
interface #endif #ifndef
__RTConfig_h__ #include
<RTConfig.h> #endif class RTActor; class RTActorRef; class
RTController; struct
RTBindingEnd; . . . int followOut( RTBindingEnd & end, RTActor * owner, int id, int index, int size ); void unreserve( RTActor * owner, int id, int size, RTActorRef * importer ,RTController *
initiator); private: // unavailable methods RTRelayPort & operator=( const
RTRelayPort & ); RTRelayPort( const RTRelayPort & ); |
#ifndef
__RTRelayPort_h__ #define
__RTRelayPort_h__ included #ifdef
PRAGMA #pragma
interface #endif #ifndef
__RTConfig_h__ #include
<RTConfig.h> #endif class RTActor; class RTActorRef; struct
RTBindingEnd; . . . int followOut( RTBindingEnd & end, RTActor * owner, int id, int index, int size ); void unreserve( RTActor
* owner, int id, int size, RTActorRef * importer ); private: // unavailable methods RTRelayPort & operator=( const
RTRelayPort & ); RTRelayPort( const RTRelayPort & ); }; |
4)
$ROSERT_HOME\C++\TargetRTS\src\RTRelayPort\unreserved.cc
NEW |
OLD |
#include
<RTActor.h> #include
<RTBindingEnd.h> #include
<RTActorRef.h> #include
<RTLayerConnector.h> #include
<RTRelayPort.h> void RTRelayPort::unreserve( RTActor * owner, int id, int size, RTActorRef * importer, RTController *
initiator) { int direct = directUse( owner->getReference(), id ); RTBindingEnd end; if( importer != (RTActorRef *)0 ) { if( _importers != (RTActorRef **)0
) { for( int repIndex = size - direct; --repIndex >= 0; ) { if( _importers[
repIndex ] == importer ) { _importers[ repIndex ] = (RTActorRef
*)0; if( owner->_followInV( end, id,
direct + repIndex ) != 0 ) { RTLayerConnector::lock(); RTLayerConnector::unbind(
initiator, end ); RTLayerConnector::unlock(); } } } } } else { // Primary container should be the
last actor to release reservations. for( int repIndex = direct;
--repIndex >= 0; ) { if( owner->_followInV( end, id, repIndex ) != 0 ) { RTLayerConnector::lock(); RTLayerConnector::unbind(
initiator, end ); RTLayerConnector::unlock(); } } } } |
#include
<RTActor.h> #include
<RTBindingEnd.h> #include
<RTActorRef.h> #include
<RTLayerConnector.h> #include
<RTRelayPort.h> void
RTRelayPort::unreserve( RTActor *
owner, int id, int size, RTActorRef * importer ) { int direct = directUse( owner->getReference(), id ); RTBindingEnd end; if( importer != (RTActorRef *)0 ) { if( _importers != (RTActorRef **)0
) { for( int repIndex = size - direct; --repIndex >= 0; ) { if( _importers[
repIndex ] == importer ) { _importers[ repIndex ] = (RTActorRef
*)0; if( owner->_followInV( end, id,
direct + repIndex ) != 0 ) { RTLayerConnector::lock(); RTLayerConnector::unbind(
importer->context(), end ); RTLayerConnector::unlock(); } } } } } else { // Primary container should be the
last actor to release reservations. for( int repIndex = direct;
--repIndex >= 0; ) { if( owner->_followInV( end, id, repIndex ) != 0 ) { RTLayerConnector::lock(); RTLayerConnector::unbind(
owner->context(), end ); RTLayerConnector::unlock(); } } } } |
5)
$ROSERT_HOME\C++\TargetRTS\src\RTActor\removeAllImports.cc
NEW |
OLD |
#include
<RTActor.h> #include
<RTActorRef.h> #include
<RTImportList.h> void RTActor::removeAllImports( RTController * initiator ) { #if
USE_THREADS RTActorRef::lock(); #endif RTImportList * list; for( list = importList; list !=
(RTImportList *)0; list = list->used.next ) _unbind(
list->used.reference ,initiator); list = importList; importList = (RTImportList *)0; #if
USE_THREADS RTActorRef::unlock(); #endif while( list != (RTImportList *)0 ) { RTImportList * next =
list->used.next; (void)list->used.reference->deport(
this, list,initiator ); list = next; } } |
#include
<RTActor.h> #include
<RTActorRef.h> #include
<RTImportList.h> void
RTActor::removeAllImports( void ) { #if
USE_THREADS RTActorRef::lock(); #endif RTImportList * list; for( list = importList; list !=
(RTImportList *)0; list = list->used.next ) _unbind( list->used.reference
); list = importList; importList = (RTImportList *)0; #if
USE_THREADS RTActorRef::unlock(); #endif while( list != (RTImportList *)0 ) { RTImportList * next =
list->used.next; (void)list->used.reference->deport(
this, list ); list = next; } } |
6)
$ROSERT_HOME\C++\TargetRTS\src\RTActor\removemport.cc
NEW |
OLD |
#include
<RTActor.h> #include
<RTActorRef.h> #include
<RTImportList.h> int RTActor::removeImport( RTActorRef * ref ,RTController
* initiator ) { #if
USE_THREADS RTActorRef::lock(); #endif RTImportList * list = importList; RTImportList ** link = &importList; while( list != (RTImportList *)0 ) { if( list->used.reference == ref
) { _unbind( ref ,initiator); *link = list->used.next; #if
USE_THREADS RTActorRef::unlock(); #endif (void)ref->deport( this,
list,initiator); return 1; } link = &list->used.next; list = list->used.next; } #if
USE_THREADS RTActorRef::unlock(); #endif return 0; } |
#include
<RTActor.h> #include
<RTActorRef.h> #include
<RTImportList.h> int
RTActor::removeImport( RTActorRef * ref ) { #if
USE_THREADS RTActorRef::lock(); #endif RTImportList * list = importList; RTImportList ** link = &importList; while( list != (RTImportList *)0 ) { if( list->used.reference == ref
) { _unbind( ref ); *link = list->used.next; #if
USE_THREADS RTActorRef::unlock(); #endif (void)ref->deport( this, list ); return 1; } link = &list->used.next; list = list->used.next; } #if
USE_THREADS RTActorRef::unlock(); #endif return 0; } |
7)
$ROSERT_HOME\C++\TargetRTS\src\RTActor\unbind.cc
NEW |
OLD |
#include
<RTActor.h> #include
<RTActorClass.h> #include
<RTActor_class.h> #include
<RTPortDescriptor.h> #include
<RTRelayDescriptor.h> #include
<RTRelayPort.h> void RTActor::_unbind( RTActorRef * importer
,RTController* initiator) { const RTActor_class * info =
getActorData(); const RTActorClass * type = info->type; for( int relayId = type->numRelays;
--relayId >= 0; ) { RTRelayPort * relay = & relays[ relayId ]; int size =
type->relays[ relayId ].replication; relay->unreserve(
this, relayId, size, importer, initiator); } } |
#include
<RTActor.h> #include
<RTActorClass.h> #include
<RTActor_class.h> #include
<RTPortDescriptor.h> #include
<RTRelayDescriptor.h> #include
<RTRelayPort.h> void
RTActor::_unbind( RTActorRef * importer ) { const RTActor_class * info =
getActorData(); const RTActorClass * type = info->type; for( int relayId = type->numRelays;
--relayId >= 0; ) { RTRelayPort * relay = & relays[ relayId ]; int size =
type->relays[ relayId ].replication; relay->unreserve( this,
relayId, size, importer ); } } |
8)
$ROSERT_HOME\C++\TargetRTS\src\RTActorRef\bind_ports.cc
NEW |
OLD |
int
RTActorRef::bind_ports( RTActor * actor, int index, RTActorRef * importer ) { RTAssert( actor != (RTActor *)0 ); . . . RTRelayPort * relay; const RTInterfaceDescriptor * iface; RTController *
controller = myOwner->context(); for( relayId = 0, . . . while( --relayId >= 0 ) { --relayDesc; --relay; --iface; relay->unreserve( myOwner, relayId,
relayDesc->replication, importer,controller); } return 0; } RTBindingEnd end1; RTBindingEnd end2; . . . |
int
RTActorRef::bind_ports( RTActor * actor, int index, RTActorRef * importer ) { RTAssert( actor != (RTActor *)0 ); . . . RTRelayPort * relay; const RTInterfaceDescriptor * iface; for( relayId = 0, . . . while( --relayId >= 0 ) { --relayDesc; --relay; --iface; relay->unreserve( myOwner, relayId,
relayDesc->replication, importer
); } return 0; }
RTController * controller = myOwner->context(); RTBindingEnd end1; RTBindingEnd end2; . . . |
9)
$ROSERT_HOME\C++\TargetRTS\src\RTActorRef\deport_one.cc
NEW |
OLD |
int RTActorRef::deport( RTActor * actor, RTImportList *
entry, RTController * initiator ) { RTAssert( actor != (RTActor *)0 ); if( entry->used.actor != actor ||
entry->used.reference != this ) { initiator->setError(
RTController::badIndex, RTController::FrameDeport, this, (const void *)0 ); return 0; } int replication = _info->replication; RTImportList * first; if( replication == 1 ) first = (RTImportList *)_contents; else { RTImportList::Unused * head =
(RTImportList::Unused *)_contents; first = (RTImportList *)(void
*)&head[ 1 ]; } int index = entry - first; //lint !e946
!e947 if( index < 0 || index >= replication
) { initiator->setError(
RTController::badIndex, RTController::FrameDeport, this, (const void *)0 ); return 0; } remove( index ); return 1; } |
int
RTActorRef::deport( RTActor * actor, RTImportList * entry ) { RTAssert( actor != (RTActor *)0 ); if( entry->used.actor != actor ||
entry->used.reference != this ) { context()->setError(
RTController::badIndex, RTController::FrameDeport, this, (const void *)0 ); return 0; } int replication = _info->replication; RTImportList * first; if( replication == 1 ) first = (RTImportList *)_contents; else { RTImportList::Unused * head =
(RTImportList::Unused *)_contents; first = (RTImportList *)(void
*)&head[ 1 ]; } int index = entry - first; //lint !e946
!e947 if( index < 0 || index >=
replication ) { context()->setError(
RTController::badIndex, RTController::FrameDeport, this, (const void *)0 ); return 0; } remove( index ); return 1; } |
10) $ROSERT_HOME\C++\TargetRTS\src\RTActorRef\deport_RTActor.cc
NEW |
OLD |
#include
<RTActor.h> #include
<RTActorRef.h> #include
<RTComponentDescriptor.h> #include
<RTDebugger.h> int
RTActorRef::deport( RTActor * a ) { // This
is the initiator context RTController * controller = context(); controller->trace(
RTController::FrameDeport, this, (const void *)0 ); if( a == (RTActor *)0 ) { controller->setError(
RTController::badActor, RTController::FrameDeport, this, (const void *)0 ); return 0; } if( _info->kind !=
RTComponentDescriptor::Imported ) { controller->setError(
RTController::notImported, RTController::FrameDeport, this, (const void *)0 ); return 0; } return
a->removeImport( this ,controller); } |
#include
<RTActor.h> #include
<RTActorRef.h> #include
<RTComponentDescriptor.h> #include
<RTDebugger.h> int
RTActorRef::deport( RTActor * a ) { RTController * controller = context(); controller->trace(
RTController::FrameDeport, this, (const void *)0 ); if( a == (RTActor *)0 ) { controller->setError(
RTController::badActor, RTController::FrameDeport, this, (const void *)0 ); return 0; } if( _info->kind !=
RTComponentDescriptor::Imported ) { controller->setError(
RTController::notImported, RTController::FrameDeport, this, (const void *)0 ); return 0; }
return a->removeImport( this ); } |
11) $ROSERT_HOME\C++\TargetRTS\src\RTActorRef\destroy_RTActor.cc
NEW |
OLD |
#include
<RTActor.h> #include
<RTActorRef.h> #include
<RTActor_class.h> #include
<RTPortDescriptor.h> #include
<RTProtocol.h> int
RTActorRef::destroy( RTActor * actor ) { // This is the initiator context RTController * controller = context(); . . . end->bindingNotification( 0 ); } } // deport actor
from all of the places that imported it
actor->removeAllImports(controller); #if
USE_THREADS && RTFRAME_THREAD_SAFE lock(); #endif
actor->_unbind((RTActorRef *)0,controller); #if
USE_THREADS && RTFRAME_THREAD_SAFE unlock(); #endif remove( index ); controller->destroy( actor,
getOwner() ); return 1; } |
#include
<RTActor.h> #include
<RTActorRef.h> #include
<RTActor_class.h> #include
<RTPortDescriptor.h> #include
<RTProtocol.h> int
RTActorRef::destroy( RTActor * actor ) { RTController * controller = context(); . . . end->bindingNotification( 0 ); } } //
deport actor from all of the places that imported it
actor->removeAllImports(); #if
USE_THREADS && RTFRAME_THREAD_SAFE lock(); #endif
actor->_unbind(); #if
USE_THREADS && RTFRAME_THREAD_SAFE unlock(); #endif remove( index ); controller->destroy( actor,
getOwner() ); return 1; } |
1.
Changes applicable to Windows platform Only:-
12) $ROSERT_HOME\C++\TargetRTS\src\RTProtocol\reply.cc(Windows only)
OLD |
NEW |
int
RTProtocol::reply( ) { . . . #if OBSERVABLE . . . #endif #if USE_THREADS int need_lock
= end->state ==
End::BoundXThread; if( need_lock
!= 0 )
RTLayerConnector::lock(); #endif if( end->state == End::Unbound ) { controller->setError( RTController::noConnect,
RTController::CommReply, this, &index ); #if USE_THREADS if( need_lock
!= 0 )
RTLayerConnector::unlock(); #endif
controller->freeMsg( replyBuffer ); return 0; }
remotePort = end->remote;
remoteIndex = end->remoteIndex;
remoteActor = remotePort- >getOwner();
replyBuffer->setDestination(
remoteActor, remotePort, remoteIndex );
replyBuffer->internData(); #if USE_THREADS . . . } |
int RTProtocol::reply( ) { . . . #if OBSERVABLE . . . #endif if( end->state == End::Unbound ) { controller->setError(
RTController::noConnect,
RTController::CommReply, this, &index ); controller->freeMsg(
replyBuffer ); return
0; } replyBuffer->internData(); #if USE_THREADS //
The binding may have been severed while we were busy interning the data. int
need_lock = 0;
switch( end->state ) { case End::Unbound: controller->setError(
RTController::noConnect,
RTController::CommReply, this,
&index ); controller->freeMsg( replyBuffer ); return
0; case
End::BoundXThread: need_lock
= 1; RTLayerConnector::lock(); break; default: break; } #endif remotePort = end->remote; remoteIndex = end->remoteIndex; remoteActor = remotePort- >getOwner(); replyBuffer->setDestination(
remoteActor, remotePort, remoteIndex ); #if USE_THREADS . . . } |
13) $ROSERT_HOME\C++\TargetRTS\src\RTProtocol\sendOne.cc(Windows only)
OLD |
NEW |
int RTProtocol::End::send( ) { . . . #if USE_THREADS int need_lock =
state == BoundXThread; if( need_lock
!= 0 ) RTLayerConnector::lock(); #endif if( state == Unbound ) { sender->setError(
RTController::noConnect, RTController::CommSend, port, &index
); #if USE_THREADS if( need_lock != 0 ) RTLayerConnector::unlock(); #endif sender->freeMsg(
msg ); return
0; } remoteActor =
remote->getOwner();
msg->setDestination( remoteActor,
remote,
remoteIndex ); msg->internData(); #if USE_THREADS . . . |
int
RTProtocol::End::send( { . . . if( state == Unbound ) { sender->setError( RTController::noConnect, RTController::CommSend, port, &index
); sender->freeMsg( msg ); return 0; } msg->internData(); #if USE_THREADS //
The binding may have been severed while we were busy interning the data. int
need_lock = 0; switch(
state ) { case
Unbound: sender->setError( RTController::noConnect,
RTController::CommSend, port, &index );
Sender->freeMsg( msg ); return
0; case
BoundXThread: need_lock
= 1; RTLayerConnector::lock(); break; default: break; } #endif remoteActor = remote->getOwner(); msg->setDestination( remoteActor,
remote, remoteIndex ); #if USE_THREADS . . . |
2.
Changes applicable to Windows, Solaris and Linux platforms:-
14) $ROSERT_HOME\C++\TargetRTS\src\RTDictionary\find.cc
OLD |
NEW |
RTAssociation *
RTDictionary::find( const char * key ) const { . . . for(;;) { if( assoc->key != (char *)0 && assoc->key != (char *)assoc && RTMemoryUtil::strcmp( assoc->key, key ) == 0 ) { return assoc; } if( ++tests == _size ) break; // we looked everywhere . . . } |
RTAssociation *
RTDictionary::find( const char * key ) const { . . . for(;;) { if( assoc->key != (char
*)0 && assoc->key != (char *)assoc && RTMemoryUtil::strcmp( assoc->key, key ) == 0 ) { return assoc; } if(
assoc->key == (char *)0 ) break; if( ++tests == _size ) break; // we looked everywhere . . . } |
15) $ROSERT_HOME\C\TargetRTS\src\Dictnary\get.c
OLD |
NEW |
void * RTDictionary_get( const
RTDictionary * this, const char * key ) { . . . for(;;) { if( assoc->key != (char *)0 && assoc->key != (char *)assoc && RTMemoryUtil_strcmp( assoc->key, key ) == 0 ) { return assoc->value; } if( ++tests == this->_size )
break; /* we looked everywhere */ . . . } |
void *
RTDictionary_get( const RTDictionary * this, const char * key ) { . . . for(;;) { if( assoc->key != (char
*)0 && assoc->key != (char *)assoc && RTMemoryUtil_strcmp( assoc->key, key ) == 0 ) { return assoc->value; } if(
assoc->key == (char *)0 ) break; if( ++tests == this->_size )
break; /* we looked everywhere */ . . . } |
16) $ROSERT_HOME\MISRAC\TargetRTS\src\Dictnary\get.c
OLD |
NEW |
void * RTDictionary_get( const
RTDictionary * this, const SI_8 * key ) { . . . while(breakOut == 0) { if( (assoc->key != (SI_8 *)0) &&
(assoc->key != (SI_8 *)assoc ) ) { if(RTMemoryUtil_strcmp(
assoc->key, key ) == 0 ) { retVal
= assoc->value; breakOut
= 1; } } if(breakOut == 0) { . . . } |
void *
RTDictionary_get( const RTDictionary * this, const SI_8 * key ) { . . . while(breakOut == 0) { if( (assoc->key != (SI_8 *)0) && (assoc->key != (SI_8 *)assoc ) ) { if(RTMemoryUtil_strcmp( assoc->key, key ) == 0 ) { retVal = assoc->value; breakOut = 1; } } if(
assoc->key == (SI_8 *)0 ) { breakOut
= 1; } if(breakOut == 0) { . . . } |
After applying this iFix
you will need to re-build your custom TargetRTS libraries.