#include <iostream>
-namespace Trace {
+namespace trace {
typedef unsigned Id;
class Float : public Value
{
public:
- Float(double _value) : value(_value) {}
+ Float(float _value) : value(_value) {}
+
+ bool toBool(void) const;
+ signed long long toSInt(void) const;
+ unsigned long long toUInt(void) const;
+ virtual float toFloat(void) const;
+ virtual double toDouble(void) const;
+ void visit(Visitor &visitor);
+
+ float value;
+};
+
+
+class Double : public Value
+{
+public:
+ Double(double _value) : value(_value) {}
bool toBool(void) const;
signed long long toSInt(void) const;
virtual void visit(SInt *);
virtual void visit(UInt *);
virtual void visit(Float *);
+ virtual void visit(Double *);
virtual void visit(String *);
virtual void visit(Enum *);
virtual void visit(Bitmask *);
}
+typedef unsigned CallFlags;
+
+/**
+ * Call flags.
+ *
+ * TODO: It might be better to to record some of these (but not all) into the
+ * trace file.
+ */
+enum {
+
+ /**
+ * Whether a call was really done by the application or not.
+ *
+ * This flag is set for fake calls -- calls not truly done by the application
+ * but emitted and recorded for completeness, to provide contextual information
+ * necessary for retracing, that would not be available through other ways.
+ *
+ * XXX: This one definetely needs to go into the trace file.
+ */
+ CALL_FLAG_FAKE = (1 << 0),
+
+ /**
+ * Whether this call should be retraced or ignored.
+ *
+ * This flag is set for calls which can't be safely replayed (due to incomplete
+ * information) or that have no sideffects.
+ *
+ * Some incomplete calls are unreproduceable, but not all.
+ */
+ CALL_FLAG_NON_REPRODUCIBLE = (1 << 1),
+
+ /**
+ * Whether this call has no side-effects, therefore don't need to be
+ * retraced.
+ *
+ * This flag is set for calls that merely query information which is not
+ * needed for posterior calls.
+ */
+ CALL_FLAG_NO_SIDE_EFFECTS = (1 << 2),
+
+ /**
+ * Whether this call renders into the bound rendertargets.
+ */
+ CALL_FLAG_RENDER = (1 << 3),
+
+ /**
+ * Whether this call causes render target to be swapped.
+ *
+ * This does not mark frame termination by itself -- that's solely the
+ * responsibility of `endOfFrame` bit.
+ *
+ * This mean that snapshots should be take prior to the call, and not
+ * after.
+ */
+ CALL_FLAG_SWAP_RENDERTARGET = (1 << 4),
+
+ /**
+ * Whether this call terminates a frame.
+ *
+ * XXX: This can't always be determined by the function name, so it should also
+ * go into the trace file eventually.
+ */
+ CALL_FLAG_END_FRAME = (1 << 5),
+
+ /**
+ * Whether this call is incomplete, i.e., it never returned.
+ */
+ CALL_FLAG_INCOMPLETE = (1 << 6),
+
+ /**
+ * Whether this call is verbose (i.e., not usually interesting).
+ */
+ CALL_FLAG_VERBOSE = (1 << 7),
+};
+
+
+
class Call
{
public:
std::vector<Value *> args;
Value *ret;
- Call(FunctionSig *_sig) : sig(_sig), args(_sig->num_args), ret(0) { }
+ CallFlags flags;
+
+ Call(FunctionSig *_sig, const CallFlags &_flags) :
+ sig(_sig),
+ args(_sig->num_args),
+ ret(0),
+ flags(_flags) {
+ }
+
~Call();
inline const char * name(void) const {
}
-} /* namespace Trace */
+} /* namespace trace */
#endif /* _TRACE_MODEL_HPP_ */