diff --git a/bin/ch/ChakraRtInterface.h b/bin/ch/ChakraRtInterface.h index 2e7916d3297..071ff398d1b 100644 --- a/bin/ch/ChakraRtInterface.h +++ b/bin/ch/ChakraRtInterface.h @@ -92,7 +92,7 @@ struct JsAPIHooks typedef JsErrorCode(WINAPI *JsrtTTDNotifyYieldPtr)(); typedef JsErrorCode(WINAPI *JsrtTTDHostExitPtr)(int statusCode); - typedef JsErrorCode(WINAPI *JsrtTTDGetSnapTimeTopLevelEventMovePtr)(JsRuntimeHandle runtimeHandle, JsTTDMoveMode moveMode, int64_t* targetEventTime, int64_t* targetStartSnapTime, int64_t* targetEndSnapTime); + typedef JsErrorCode(WINAPI *JsrtTTDGetSnapTimeTopLevelEventMovePtr)(JsRuntimeHandle runtimeHandle, JsTTDMoveMode moveMode, uint32_t kthEvent, int64_t* targetEventTime, int64_t* targetStartSnapTime, int64_t* targetEndSnapTime); typedef JsErrorCode(WINAPI *JsrtTTDMoveToTopLevelEventPtr)(JsRuntimeHandle runtimeHandle, JsTTDMoveMode moveMode, int64_t snapshotStartTime, int64_t eventTime); typedef JsErrorCode(WINAPI *JsrtTTDReplayExecutionPtr)(JsTTDMoveMode* moveMode, int64_t* rootEventTime); @@ -360,7 +360,7 @@ class ChakraRTInterface static JsErrorCode WINAPI JsTTDNotifyYield() { return HOOK_JS_API(TTDNotifyYield()); } static JsErrorCode WINAPI JsTTDHostExit(int statusCode) { return HOOK_JS_API(TTDHostExit(statusCode)); } - static JsErrorCode WINAPI JsTTDGetSnapTimeTopLevelEventMove(JsRuntimeHandle runtimeHandle, JsTTDMoveMode moveMode, int64_t* targetEventTime, int64_t* targetStartSnapTime, int64_t* targetEndSnapTime) { return HOOK_JS_API(TTDGetSnapTimeTopLevelEventMove(runtimeHandle, moveMode, targetEventTime, targetStartSnapTime, targetEndSnapTime)); } + static JsErrorCode WINAPI JsTTDGetSnapTimeTopLevelEventMove(JsRuntimeHandle runtimeHandle, JsTTDMoveMode moveMode, uint32_t kthEvent, int64_t* targetEventTime, int64_t* targetStartSnapTime, int64_t* targetEndSnapTime) { return HOOK_JS_API(TTDGetSnapTimeTopLevelEventMove(runtimeHandle, moveMode, kthEvent, targetEventTime, targetStartSnapTime, targetEndSnapTime)); } static JsErrorCode WINAPI JsTTDMoveToTopLevelEvent(JsRuntimeHandle runtimeHandle, JsTTDMoveMode moveMode, int64_t snapshotStartTime, int64_t eventTime) { return HOOK_JS_API(TTDMoveToTopLevelEvent(runtimeHandle, moveMode, snapshotStartTime, eventTime)); } static JsErrorCode WINAPI JsTTDReplayExecution(JsTTDMoveMode* moveMode, int64_t* rootEventTime) { return HOOK_JS_API(TTDReplayExecution(moveMode, rootEventTime)); } diff --git a/bin/ch/ch.cpp b/bin/ch/ch.cpp index 113b13442b4..03e1f2f0812 100644 --- a/bin/ch/ch.cpp +++ b/bin/ch/ch.cpp @@ -272,13 +272,13 @@ HRESULT RunScript(const char* fileName, LPCSTR fileContents, BYTE *bcBuffer, cha try { - JsTTDMoveMode moveMode = (JsTTDMoveMode)(JsTTDMoveMode::JsTTDMoveKthEvent | ((int64) startEventCount) << 32); + JsTTDMoveMode moveMode = JsTTDMoveMode::JsTTDMoveKthEvent; int64_t snapEventTime = -1; int64_t nextEventTime = -2; while(true) { - JsErrorCode error = ChakraRTInterface::JsTTDGetSnapTimeTopLevelEventMove(chRuntime, moveMode, &nextEventTime, &snapEventTime, nullptr); + JsErrorCode error = ChakraRTInterface::JsTTDGetSnapTimeTopLevelEventMove(chRuntime, moveMode, startEventCount, &nextEventTime, &snapEventTime, nullptr); if(error != JsNoError) { diff --git a/lib/Jsrt/ChakraCommon.h b/lib/Jsrt/ChakraCommon.h index d36fc9cff98..d764d18135a 100644 --- a/lib/Jsrt/ChakraCommon.h +++ b/lib/Jsrt/ChakraCommon.h @@ -71,6 +71,7 @@ typedef BYTE* ChakraBytePtr; #define CHAKRA_API extern "C" SET_API_VISIBILITY JsErrorCode #else #define CHAKRA_API extern SET_API_VISIBILITY JsErrorCode +#include #endif #include // for size_t @@ -321,7 +322,7 @@ typedef UINT32 DWORD; /// /// An invalid runtime handle. /// - const JsRuntimeHandle JS_INVALID_RUNTIME_HANDLE = nullptr; + const JsRuntimeHandle JS_INVALID_RUNTIME_HANDLE = 0; /// /// A reference to an object owned by the Chakra garbage collector. @@ -338,7 +339,7 @@ typedef UINT32 DWORD; /// /// An invalid reference. /// - const JsRef JS_INVALID_REFERENCE = nullptr; + const JsRef JS_INVALID_REFERENCE = 0; /// /// A reference to a script context. diff --git a/lib/Jsrt/ChakraDebug.h b/lib/Jsrt/ChakraDebug.h index 178abf51fa5..c79262c0549 100644 --- a/lib/Jsrt/ChakraDebug.h +++ b/lib/Jsrt/ChakraDebug.h @@ -643,7 +643,7 @@ typedef __int64 int64_t; /// /// TimeTravel move options as bit flag enum. /// - typedef enum _JsTTDMoveModes : int64_t + typedef enum _JsTTDMoveModes { /// /// Indicates no special actions needed for move. @@ -966,6 +966,7 @@ typedef __int64 int64_t; /// /// The runtime handle that the script is executing in. /// Flags controlling the way the move it performed and how other parameters are interpreted. + /// When moveMode == JsTTDMoveKthEvent indicates which event, otherwise this parameter is ignored. /// The event time we want to move to or -1 if not relevant. /// Out parameter with the event time of the snapshot that we should inflate from. /// Optional Out parameter with the snapshot time following the event. @@ -973,6 +974,7 @@ typedef __int64 int64_t; CHAKRA_API JsTTDGetSnapTimeTopLevelEventMove( _In_ JsRuntimeHandle runtimeHandle, _In_ JsTTDMoveMode moveMode, + _In_opt_ uint32_t kthEvent, _Inout_ int64_t* targetEventTime, _Out_ int64_t* targetStartSnapTime, _Out_opt_ int64_t* targetEndSnapTime); diff --git a/lib/Jsrt/Jsrt.cpp b/lib/Jsrt/Jsrt.cpp index 2b764f8aaf8..3a857bd65f7 100644 --- a/lib/Jsrt/Jsrt.cpp +++ b/lib/Jsrt/Jsrt.cpp @@ -3742,8 +3742,9 @@ CHAKRA_API JsTTDCheckAndAssertIfTTDRunning(_In_ const char* msg) } CHAKRA_API JsTTDGetSnapTimeTopLevelEventMove(_In_ JsRuntimeHandle runtimeHandle, - _In_ JsTTDMoveMode moveMode, _Inout_ int64_t* targetEventTime, - _Out_ int64_t* targetStartSnapTime, _Out_opt_ int64_t* targetEndSnapTime) + _In_ JsTTDMoveMode moveMode, _In_opt_ uint32_t kthEvent, + _Inout_ int64_t* targetEventTime, _Out_ int64_t* targetStartSnapTime, + _Out_opt_ int64_t* targetEndSnapTime) { #if !ENABLE_TTD return JsErrorCategoryUsage; @@ -3778,7 +3779,6 @@ CHAKRA_API JsTTDGetSnapTimeTopLevelEventMove(_In_ JsRuntimeHandle runtimeHandle, } else if((moveMode & JsTTDMoveMode::JsTTDMoveKthEvent) == JsTTDMoveMode::JsTTDMoveKthEvent) { - uint32 kthEvent = (uint32)(((int64)moveMode) >> 32); *targetEventTime = threadContext->TTDLog->GetKthEventTimeInLog(kthEvent); if(*targetEventTime == -1) {