diff options
| author | Andrew M. B. Boktor <[email protected]> | 2012-04-13 15:16:51 -0800 |
|---|---|---|
| committer | Andrew Boktor <[email protected]> | 2014-08-14 13:19:05 -0700 |
| commit | ce59b2c4ed93e27cb7cc226e6c749769f37e30ce (patch) | |
| tree | 245da25dbea1272aeb9a91804815e07855888457 | |
| parent | e1c63461d124b3ee5d18af54592ed1904816bcb5 (diff) | |
Merging
//depot/gpgpu_sim_research/fermi-test/distribution/src/intersim/...
to //depot/gpgpu_sim_research/fermi/distribution/src/intersim/...
Fixes a segmentation fault that happens with newer gcc.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 11939]
| -rw-r--r-- | src/intersim/allocator.cpp | 40 | ||||
| -rw-r--r-- | src/intersim/allocator.hpp | 4 | ||||
| -rw-r--r-- | src/intersim/selalloc.cpp | 8 |
3 files changed, 28 insertions, 24 deletions
diff --git a/src/intersim/allocator.cpp b/src/intersim/allocator.cpp index b7aae5d..b242416 100644 --- a/src/intersim/allocator.cpp +++ b/src/intersim/allocator.cpp @@ -160,6 +160,8 @@ SparseAllocator::SparseAllocator( const Configuration &config, int inputs, int outputs ) :
Allocator( config, parent, name, inputs, outputs )
{
+ _in_occ = new list<int>();
+ _out_occ = new list<int>();
_in_req = new list<sRequest> [_inputs];
_out_req = new list<sRequest> [_outputs];
}
@@ -169,6 +171,8 @@ SparseAllocator::~SparseAllocator( ) {
delete [] _in_req;
delete [] _out_req;
+ delete _in_occ;
+ delete _out_occ;
}
void SparseAllocator::Clear( )
@@ -181,8 +185,8 @@ void SparseAllocator::Clear( ) _out_req[j].clear( );
}
- _in_occ.clear( );
- _out_occ.clear( );
+ _in_occ->clear( );
+ _out_occ->clear( );
}
int SparseAllocator::ReadRequest( int in, int out ) const
@@ -234,28 +238,28 @@ void SparseAllocator::AddRequest( int in, int out, int label, // insert into occupied inputs list if
// input is currently empty
if ( _in_req[in].empty( ) ) {
- occ_insert = _in_occ.begin( );
- while ( ( occ_insert != _in_occ.end( ) ) &&
+ occ_insert = _in_occ->begin( );
+ while ( ( occ_insert != _in_occ->end( ) ) &&
( *occ_insert < in ) ) {
occ_insert++;
}
- assert( ( occ_insert == _in_occ.end( ) ) ||
+ assert( ( occ_insert == _in_occ->end( ) ) ||
( *occ_insert != in ) );
- _in_occ.insert( occ_insert, in );
+ _in_occ->insert( occ_insert, in );
}
// similarly for the output
if ( _out_req[out].empty( ) ) {
- occ_insert = _out_occ.begin( );
- while ( ( occ_insert != _out_occ.end( ) ) &&
+ occ_insert = _out_occ->begin( );
+ while ( ( occ_insert != _out_occ->end( ) ) &&
( *occ_insert < out ) ) {
occ_insert++;
}
- assert( ( occ_insert == _out_occ.end( ) ) ||
+ assert( ( occ_insert == _out_occ->end( ) ) ||
( *occ_insert != out ) );
- _out_occ.insert( occ_insert, out );
+ _out_occ->insert( occ_insert, out );
}
// insert input request in order of it's output
@@ -338,14 +342,14 @@ void SparseAllocator::RemoveRequest( int in, int out, int label ) // remove from occupied inputs list if
// input is now empty
if ( _in_req[in].empty( ) ) {
- occ_remove = _in_occ.begin( );
- while ( ( occ_remove != _in_occ.end( ) ) &&
+ occ_remove = _in_occ->begin( );
+ while ( ( occ_remove != _in_occ->end( ) ) &&
( *occ_remove != in ) ) {
occ_remove++;
}
- assert( occ_remove != _in_occ.end( ) );
- _in_occ.erase( occ_remove );
+ assert( occ_remove != _in_occ->end( ) );
+ _in_occ->erase( occ_remove );
}
// similarly for the output
@@ -359,14 +363,14 @@ void SparseAllocator::RemoveRequest( int in, int out, int label ) _out_req[out].erase( erase_point );
if ( _out_req[out].empty( ) ) {
- occ_remove = _out_occ.begin( );
- while ( ( occ_remove != _out_occ.end( ) ) &&
+ occ_remove = _out_occ->begin( );
+ while ( ( occ_remove != _out_occ->end( ) ) &&
( *occ_remove != out ) ) {
occ_remove++;
}
- assert( occ_remove != _out_occ.end( ) );
- _out_occ.erase( occ_remove );
+ assert( occ_remove != _out_occ->end( ) );
+ _out_occ->erase( occ_remove );
}
}
diff --git a/src/intersim/allocator.hpp b/src/intersim/allocator.hpp index ac77a3a..8d92933 100644 --- a/src/intersim/allocator.hpp +++ b/src/intersim/allocator.hpp @@ -93,8 +93,8 @@ public: class SparseAllocator : public Allocator {
protected:
- list<int> _in_occ;
- list<int> _out_occ;
+ list<int> *_in_occ;
+ list<int> *_out_occ;
list<sRequest> *_in_req;
list<sRequest> *_out_req;
diff --git a/src/intersim/selalloc.cpp b/src/intersim/selalloc.cpp index 53d31fe..fe14091 100644 --- a/src/intersim/selalloc.cpp +++ b/src/intersim/selalloc.cpp @@ -56,8 +56,8 @@ void SelAlloc::Allocate( ) for ( int iter = 0; iter < _iter; ++iter ) {
// Grant phase
- for ( outer_iter = _out_occ.begin( );
- outer_iter != _out_occ.end( ); ++outer_iter ) {
+ for ( outer_iter = _out_occ->begin( );
+ outer_iter != _out_occ->end( ); ++outer_iter ) {
output = *outer_iter;
// Skip loop if there are no requests
@@ -128,8 +128,8 @@ void SelAlloc::Allocate( ) // Accept phase
- for ( outer_iter = _in_occ.begin( );
- outer_iter != _in_occ.end( ); ++outer_iter ) {
+ for ( outer_iter = _in_occ->begin( );
+ outer_iter != _in_occ->end( ); ++outer_iter ) {
input = *outer_iter;
if ( _in_req[input].empty( ) ) {
|
