Commit b64eb84c authored by Diana Chen's avatar Diana Chen Committed by gbsbuild

Update GED library to fix some minos bugs and enhance multi-threaded build

Change-Id: I3f24754eb9d6fc4e92ee9bd25b67452b9e569a06
parent 0f708768
......@@ -54,19 +54,31 @@ extern const char* gedVersion;
# if defined(GED_DEBUG)
# ifndef GED_VALIDATE
# define GED_VALIDATE
# endif
# define GEDASSERT(cond) assert(cond)
# else
# if defined(GED_VALIDATE)
# define GEDASSERT(cond) { if (0 == (cond)) { cerr << "GED ASSERTION: " #cond << endl << \
"file " << __FILE__ << ", line " << __LINE__ << endl << flush; exit(1); } }
# else
# define GEDASSERT(cond)
# endif
# endif
# if defined(GED_VALIDATE)
# define COMMA ,
# define GEDFORASSERT(expr) expr
# define GEDASSERT(cond) assert(cond);
# define GEDASSERTM(cond, msg) { if (0 == (cond)) { cerr << msg << endl << flush; assert(cond); } }
# define GEDASSERTM(cond, msg) { if (0 == (cond)) { cerr << msg << endl << flush; GEDASSERT(cond); } }
# define GEDERRORC(code, msg) { cerr << "GED ERROR: " << __FILE__ << "::" << __FUNCTION__ << endl << msg << endl << flush; \
assert(0); }
# else // not defined GED_DEBUG
GEDASSERT(0); }
# else // not defined GED_VALIDATE
# define COMMA
# define GEDFORASSERT(expr)
# define GEDASSERT(cond)
# define GEDASSERTM(cond, msg)
# define GEDERRORC(code, msg) { cerr << "GED ERROR: " << msg << endl; GEDVERSION(cerr); cerr.flush(); exit(code); }
# endif // not defined GED_DEBUG
# endif // end of not defined GED_VALIDATE
# if defined(GED_IGNORE_WARNINGS)
......
......@@ -24,4 +24,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
======================= end_copyright_notice ==================================*/
const char* gedVersion = "dev (ad9267b2)";
const char* gedVersion = "0.25 (c9497486)";
......@@ -144,13 +144,13 @@ GED_RETURN_VALUE GEDIns::Init(const /* GED_MODEL */ uint8_t modelId, /* GED_OPCO
_opcode = invalidOpcode;
_decodingTable = NULL;
ret = SetOpcode(opcode);
#if defined(GED_DEBUG)
#if defined(GED_VALIDATE)
if (GED_RETURN_VALUE_OPCODE_NOT_SUPPORTED != ret)
{
GEDASSERT(invalidOpcode != _opcode);
GEDASSERT(NULL != _decodingTable);
}
#endif // GED_DEBUG
#endif // GED_VALIDATE
return ret;
}
......@@ -199,10 +199,10 @@ GED_RETURN_VALUE GEDIns::Decode(const /* GED_MODEL */ uint8_t modelId, const uns
// and set the instruction's compact form as encoded.
ApplyCompactEncodingMasks(_compactBytes); // enforce the per-instruction encoding restrictions for the compact format
#if defined (GED_DEBUG)
#if defined (GED_VALIDATE)
// TODO: Save the current instruction bytes, then call BuildNativeInsFromCompact again and compare the two
// to prevent field/padding conflicts in the XMLs.
#endif // GED_DEBUG
#endif // GED_VALIDATE
}
else
{
......@@ -915,7 +915,7 @@ void GEDIns::EmitMappingCyclicDependencyError(const set<uint32_t>& unMapped, con
{
depErrorStr += ", " + DecStr(*it);
}
#if defined(GED_DEBUG)
#if defined(GED_VALIDATE)
stringstream strm;
strm << setfill('0') << hex;
for (int i = GED_NUM_OF_NATIVE_INS_DWORDS - 1; i >= 0; --i)
......@@ -923,7 +923,7 @@ void GEDIns::EmitMappingCyclicDependencyError(const set<uint32_t>& unMapped, con
strm << setw(8) << ((uint32_t*)validBits)[i];
}
depErrorStr += "\nValidBits: 0x" + strm.str();
#endif // GED_DEBUG
#endif // GED_VALIDATE
// TODO: This should use GED logs instead of emitting an error. Also, consider changing the function name.
GEDERROR("Unable to map remaining unmapped fields, probably due to an implicit dependency cycle: " + depErrorStr);
}
......
......@@ -690,14 +690,14 @@ uint64_t GEDIns::GetRawQuadField(const /* GED_INS_FIELD */ uint32_t field, GED_R
void GEDIns::SignExtend(int32_t& val, const ged_ins_field_entry_t* dataEntry) const
{
#if defined(GED_DEBUG)
#if defined(GED_VALIDATE)
if (NULL != dataEntry->_restrictions)
{
// Make sure this isn't a variable field since variable fields must use unsigned getters. The variable-field modifier must be
// first in the restrictions table if it exists.
GEDASSERT(GED_FIELD_RESTRICTIONS_TYPE_FIELD_TYPE != dataEntry->_restrictions[0]->_restrictionType);
}
#endif // GED_DEBUG
#endif // GED_VALIDATE
const uint8_t highBit = dataEntry->_bitSize - 1;
if (GEDRestrictionsHandler::IsNegative(val, highBit))
{
......@@ -708,14 +708,14 @@ void GEDIns::SignExtend(int32_t& val, const ged_ins_field_entry_t* dataEntry) co
void GEDIns::SignExtend(int64_t& val, const ged_ins_field_entry_t* dataEntry) const
{
#if defined(GED_DEBUG)
#if defined(GED_VALIDATE)
if (NULL != dataEntry->_restrictions)
{
// Make sure this isn't a variable field since variable fields must use unsigned getters. The variable-field modifier must be
// first in the restrictions table if it exists.
GEDASSERT(GED_FIELD_RESTRICTIONS_TYPE_FIELD_TYPE != dataEntry->_restrictions[0]->_restrictionType);
}
#endif // GED_DEBUG
#endif // GED_VALIDATE
const uint8_t highBit = dataEntry->_bitSize - 1;
if (GEDRestrictionsHandler::IsNegative(val, highBit))
{
......
......@@ -136,21 +136,23 @@ extern "C"
/*!
* Get the string representation for the given GED_RETURN_VALUE enumerator.
* If the value is not valid, return an empty string
*
* @param[in] ReturnValue The given GED_RETURN_VALUE enumerator.
* @param[in] returnValue The given GED_RETURN_VALUE enumerator.
*
* @return The requested string.
*/
extern const char* GED_CALLCONV GED_GetReturnValueString(GED_RETURN_VALUE ReturnValue);
extern const char* GED_CALLCONV GED_GetReturnValueString(GED_RETURN_VALUE returnValue);
/*!
* Get the padding of the GED_RETURN_VALUE enum's string representation in order for it to be aligned column-wise.
* If the value is not valid, return an empty string
*
* @param[in] ReturnValue The given GED_RETURN_VALUE enumerator.
* @param[in] returnValue The given GED_RETURN_VALUE enumerator.
*
* @return The requested pad.
*/
extern const char* GED_CALLCONV GED_GetReturnValuePad(GED_RETURN_VALUE ReturnValue);
extern const char* GED_CALLCONV GED_GetReturnValuePad(GED_RETURN_VALUE returnValue);
/*!
* Initialize an empty ged_ins_t object and set its opcode. Can be called to initialize a newly allocated object or to clear an
......
......@@ -100,13 +100,19 @@ const char* GED_GetModelVersionString(GED_MODEL model)
return ModelsArray[rawModel].modelVersion;
return "";
}
const char* GED_GetReturnValueString(GED_RETURN_VALUE ReturnValue)
const char* GED_GetReturnValueString(GED_RETURN_VALUE returnValue)
{
return gedReturnValueStrings[ReturnValue];
unsigned int rawReturnValue = static_cast<unsigned int>(returnValue);
if (rawReturnValue < GED_RETURN_VALUE_SIZE)
return gedReturnValueStrings[returnValue];
return "";
}
const char* GED_GetReturnValuePad(GED_RETURN_VALUE ReturnValue)
const char* GED_GetReturnValuePad(GED_RETURN_VALUE returnValue)
{
return gedReturnValuePadding[ReturnValue];
unsigned int rawReturnValue = static_cast<unsigned int>(returnValue);
if (rawReturnValue < GED_RETURN_VALUE_SIZE)
return gedReturnValuePadding[returnValue];
return "";
}
GED_RETURN_VALUE GED_InitEmptyIns(const GED_MODEL modelId, ged_ins_t* ins, GED_OPCODE opcode)
{
......
......@@ -136,21 +136,23 @@ extern "C"
/*!
* Get the string representation for the given GED_RETURN_VALUE enumerator.
* If the value is not valid, return an empty string
*
* @param[in] ReturnValue The given GED_RETURN_VALUE enumerator.
* @param[in] returnValue The given GED_RETURN_VALUE enumerator.
*
* @return The requested string.
*/
extern const char* GED_CALLCONV GED_GetReturnValueString(GED_RETURN_VALUE ReturnValue);
extern const char* GED_CALLCONV GED_GetReturnValueString(GED_RETURN_VALUE returnValue);
/*!
* Get the padding of the GED_RETURN_VALUE enum's string representation in order for it to be aligned column-wise.
* If the value is not valid, return an empty string
*
* @param[in] ReturnValue The given GED_RETURN_VALUE enumerator.
* @param[in] returnValue The given GED_RETURN_VALUE enumerator.
*
* @return The requested pad.
*/
extern const char* GED_CALLCONV GED_GetReturnValuePad(GED_RETURN_VALUE ReturnValue);
extern const char* GED_CALLCONV GED_GetReturnValuePad(GED_RETURN_VALUE returnValue);
/*!
* Initialize an empty ged_ins_t object and set its opcode. Can be called to initialize a newly allocated object or to clear an
......
......@@ -100,13 +100,19 @@ const char* GED_GetModelVersionString(GED_MODEL model)
return ModelsArray[rawModel].modelVersion;
return "";
}
const char* GED_GetReturnValueString(GED_RETURN_VALUE ReturnValue)
const char* GED_GetReturnValueString(GED_RETURN_VALUE returnValue)
{
return gedReturnValueStrings[ReturnValue];
unsigned int rawReturnValue = static_cast<unsigned int>(returnValue);
if (rawReturnValue < GED_RETURN_VALUE_SIZE)
return gedReturnValueStrings[returnValue];
return "";
}
const char* GED_GetReturnValuePad(GED_RETURN_VALUE ReturnValue)
const char* GED_GetReturnValuePad(GED_RETURN_VALUE returnValue)
{
return gedReturnValuePadding[ReturnValue];
unsigned int rawReturnValue = static_cast<unsigned int>(returnValue);
if (rawReturnValue < GED_RETURN_VALUE_SIZE)
return gedReturnValuePadding[returnValue];
return "";
}
GED_RETURN_VALUE GED_InitEmptyIns(const GED_MODEL modelId, ged_ins_t* ins, GED_OPCODE opcode)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment