Bug fix, make the AP parser reentrant (NO static variables).

* Bug: In CRL::ApParser::_parseInstance(), the instance coordinates where
    stored in *static* variables (boo). Making the parser *not* reentrant.
    But in _parseInstance(), it can be recursively called through
    getCell() when an sub-instance layout was missing.
      Also make non-static all other variables in the various parser
    function.
This commit is contained in:
Jean-Paul Chaput 2020-04-21 15:39:35 +02:00
parent 0a664fed36
commit a4acb22e3c
1 changed files with 42 additions and 42 deletions

View File

@ -18,7 +18,6 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <cstdarg> #include <cstdarg>
#include "hurricane/DataBase.h" #include "hurricane/DataBase.h"
#include "hurricane/RegularLayer.h" #include "hurricane/RegularLayer.h"
#include "hurricane/Technology.h" #include "hurricane/Technology.h"
@ -28,7 +27,6 @@
#include "hurricane/Horizontal.h" #include "hurricane/Horizontal.h"
#include "hurricane/UpdateSession.h" #include "hurricane/UpdateSession.h"
#include "hurricane/NetExternalComponents.h" #include "hurricane/NetExternalComponents.h"
#include "crlcore/Utilities.h" #include "crlcore/Utilities.h"
#include "crlcore/AllianceFramework.h" #include "crlcore/AllianceFramework.h"
#include "crlcore/ToolBox.h" #include "crlcore/ToolBox.h"
@ -437,7 +435,7 @@ namespace {
void ApParser::_parseReference () void ApParser::_parseReference ()
{ {
static DbU::Unit XREF, YREF; DbU::Unit XREF, YREF;
vector<char*> fields = _splitString ( _rawLine+2, ',' ); vector<char*> fields = _splitString ( _rawLine+2, ',' );
if ( fields.size() < 4 ) if ( fields.size() < 4 )
@ -454,14 +452,14 @@ namespace {
void ApParser::_parseConnector () void ApParser::_parseConnector ()
{ {
static DbU::Unit XCON, YCON, WIDTH, HEIGHT; DbU::Unit XCON, YCON, WIDTH, HEIGHT;
static int index; int index;
string pinName; string pinName;
static Net* net; Net* net;
//static Pin* pin; // Pin* pin;
static LayerInformation* layerInfo; LayerInformation* layerInfo;
static Pin::AccessDirection accessDirection; Pin::AccessDirection accessDirection;
static Name orientation; Name orientation;
static Name NORTH = "NORTH"; static Name NORTH = "NORTH";
static Name SOUTH = "SOUTH"; static Name SOUTH = "SOUTH";
static Name EAST = "EAST"; static Name EAST = "EAST";
@ -537,9 +535,9 @@ namespace {
void ApParser::_parseVia () void ApParser::_parseVia ()
{ {
static DbU::Unit XVIA, YVIA; DbU::Unit XVIA, YVIA;
static Net* net; Net* net;
static LayerInformation* layerInfo; LayerInformation* layerInfo;
vector<char*> fields = _splitString ( _rawLine+2, ',' ); vector<char*> fields = _splitString ( _rawLine+2, ',' );
if ( fields.size() < 4 ) if ( fields.size() < 4 )
@ -560,9 +558,9 @@ namespace {
void ApParser::_parseBigVia () void ApParser::_parseBigVia ()
{ {
static DbU::Unit XVIA, YVIA, WIDTH, HEIGHT; DbU::Unit XVIA, YVIA, WIDTH, HEIGHT;
static Net* net; Net* net;
static LayerInformation* layerInfo; LayerInformation* layerInfo;
vector<char*> fields = _splitString ( _rawLine+2, ',' ); vector<char*> fields = _splitString ( _rawLine+2, ',' );
if ( fields.size() < 6 ) if ( fields.size() < 6 )
@ -590,10 +588,10 @@ namespace {
void ApParser::_parseSegment () void ApParser::_parseSegment ()
{ {
static DbU::Unit X1, Y1, X2, Y2, WIDTH; DbU::Unit X1, Y1, X2, Y2, WIDTH;
static Net* net; Net* net;
static LayerInformation* layerInfo; LayerInformation* layerInfo;
static SegmentDirection segDir; SegmentDirection segDir;
vector<char*> fields = _splitString ( _rawLine+2, ',' ); vector<char*> fields = _splitString ( _rawLine+2, ',' );
if ( fields.size() < 8 ) if ( fields.size() < 8 )
@ -645,11 +643,11 @@ namespace {
void ApParser::_parseInstance () void ApParser::_parseInstance ()
{ {
static DbU::Unit XINS, YINS; DbU::Unit XINS, YINS;
static Name masterCellName; Name masterCellName;
static Name instanceName; Name instanceName;
static Name orientName; Name orientName;
static Transformation::Orientation Transformation::Orientation
orient = Transformation::Orientation::ID; orient = Transformation::Orientation::ID;
static Name NOSYM = "NOSYM"; static Name NOSYM = "NOSYM";
static Name SYM_X = "SYM_X"; static Name SYM_X = "SYM_X";
@ -687,8 +685,10 @@ namespace {
Cell* masterCell = instance->getMasterCell(); Cell* masterCell = instance->getMasterCell();
bool hasLayout = not masterCell->getAbutmentBox().isEmpty(); bool hasLayout = not masterCell->getAbutmentBox().isEmpty();
if (not hasLayout) { if (not hasLayout) {
tab++;
AllianceFramework::get()->getCell( getString(masterCell->getName()), Catalog::State::Physical ); AllianceFramework::get()->getCell( getString(masterCell->getName()), Catalog::State::Physical );
hasLayout = not masterCell->getAbutmentBox().isEmpty(); hasLayout = not masterCell->getAbutmentBox().isEmpty();
tab--;
} }
if (hasLayout) { if (hasLayout) {