1
0
mirror of synced 2026-04-30 13:31:51 +00:00

Morphed undocumented behavior asserts into things that can be silenced.

Some instruction encoding combinations are not documented
in the Cray manuals. These were asserted upon previously.
This causes crashes if those instructions are encountered.
Obviously not ideal for "production" code. The new behavior
replaces these by the exceptions that can be supressed.
This commit is contained in:
Andras Tantos
2025-02-17 22:30:44 +00:00
parent 21b5680ba8
commit 2ac3afbaad
5 changed files with 41 additions and 21 deletions

View File

@@ -57,6 +57,23 @@
} while (false);
#define CRAY_UNDOCUMENTED(aCond, aRetVal) \
do { \
if (!(aCond)) { \
UndocumentedInstError_x Error(__FILE__,__LINE__,#aCond); \
if (mThrowOnUnknown) { \
throw Error; \
} else { \
mLogger << setloglevel(LogLevel_Error) << Error.what() << std::endl; \
if (aRetVal > 0) return aRetVal; \
} \
} \
} while (false);
#define CRAY_UNDOCUMENTED_FLOW_THROUGH(aCond) CRAY_UNDOCUMENTED(aCond, 0)
inline size_t FirstParcel(uint64_t aInst) { return size_t((aInst >> 32) & 0xffff); }
inline size_t SecondParcel(uint64_t aInst) { return size_t((aInst >> 16) & 0xffff); }
inline size_t ThirdParcel(uint64_t aInst) { return size_t((aInst >> 0) & 0xffff); }
@@ -852,6 +869,7 @@ protected:
struct DataWriteOutOfBoundsError_x: public Generic_x { DataWriteOutOfBoundsError_x() : Generic_x("Data write out of bounds") {} };
struct InstDecodeError_x : public Generic_x { InstDecodeError_x() : Generic_x("Instruction decode error") {} };
struct UnknownInstError_x : public Generic_x { UnknownInstError_x(const char *aFile, size_t aLine) : Generic_x("Unknown instruction error at") { *this << aFile << ":" << DecPrinter(aLine, 0); } };
struct UndocumentedInstError_x : public Generic_x { UndocumentedInstError_x(const char *aFile, size_t aLine, const char *aCond) : Generic_x("Undocumented instruction behavior error at") { *this << aFile << ":" << DecPrinter(aLine, 0) << " faild condition: " << aCond; } };
struct TerminateInstError_x : public Generic_x { TerminateInstError_x() : Generic_x("Terminate instruction executed") {} };
struct InstExecError_x : public Generic_x { InstExecError_x() : Generic_x("Instruction execution error") {} };
struct InstUnimplementedError_x : public Generic_x { InstUnimplementedError_x(const char *aFile, size_t aLine) { *this << "Unimplemented instruction at " << aFile << ":" << DecPrinter(aLine, 0); ResetSpacePrinted(); } };