2
0

JITManager.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #include "JITClientPch.h"
  6. _Must_inspect_result_
  7. _Ret_maybenull_ _Post_writable_byte_size_(size)
  8. void * __RPC_USER midl_user_allocate(
  9. #if defined(_WIN32_WINNT_WIN10)
  10. _In_ // starting win10, _In_ is in the signature
  11. #endif
  12. size_t size)
  13. {
  14. return (HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size));
  15. }
  16. void __RPC_USER midl_user_free(_Pre_maybenull_ _Post_invalid_ void * ptr)
  17. {
  18. if (ptr != NULL)
  19. {
  20. HeapFree(GetProcessHeap(), NULL, ptr);
  21. }
  22. }
  23. JITManager JITManager::s_jitManager = JITManager();
  24. JITManager::JITManager() :
  25. m_rpcBindingHandle(nullptr),
  26. m_oopJitEnabled(false),
  27. m_isJITServer(false),
  28. m_failingHRESULT(S_OK),
  29. m_jitConnectionId()
  30. {
  31. }
  32. JITManager::~JITManager()
  33. {
  34. if (m_rpcBindingHandle)
  35. {
  36. RpcBindingFree(&m_rpcBindingHandle);
  37. }
  38. }
  39. /* static */
  40. JITManager *
  41. JITManager::GetJITManager()
  42. {
  43. return &s_jitManager;
  44. }
  45. // This routine creates a binding with the server.
  46. HRESULT
  47. JITManager::CreateBinding(
  48. __in HANDLE serverProcessHandle,
  49. __in_opt void * serverSecurityDescriptor,
  50. __in UUID * connectionUuid,
  51. __out RPC_BINDING_HANDLE * bindingHandle)
  52. {
  53. Assert(IsOOPJITEnabled());
  54. RPC_STATUS status;
  55. DWORD attemptCount = 0;
  56. DWORD sleepInterval = 100; // in milliseconds
  57. RPC_BINDING_HANDLE localBindingHandle;
  58. RPC_BINDING_HANDLE_TEMPLATE_V1 bindingTemplate;
  59. RPC_BINDING_HANDLE_SECURITY_V1_W bindingSecurity;
  60. #ifndef NTBUILD
  61. RPC_SECURITY_QOS_V4 securityQOS;
  62. ZeroMemory(&securityQOS, sizeof(RPC_SECURITY_QOS_V4));
  63. securityQOS.Capabilities = RPC_C_QOS_CAPABILITIES_DEFAULT;
  64. securityQOS.IdentityTracking = RPC_C_QOS_IDENTITY_DYNAMIC;
  65. securityQOS.ImpersonationType = RPC_C_IMP_LEVEL_IDENTIFY;
  66. securityQOS.Version = 4;
  67. #else
  68. RPC_SECURITY_QOS_V5 securityQOS;
  69. ZeroMemory(&securityQOS, sizeof(RPC_SECURITY_QOS_V5));
  70. securityQOS.Capabilities = RPC_C_QOS_CAPABILITIES_DEFAULT;
  71. securityQOS.IdentityTracking = RPC_C_QOS_IDENTITY_DYNAMIC;
  72. securityQOS.ImpersonationType = RPC_C_IMP_LEVEL_IDENTIFY;
  73. securityQOS.Version = 5;
  74. securityQOS.ServerSecurityDescriptor = serverSecurityDescriptor;
  75. #endif // NTBUILD
  76. ZeroMemory(&bindingTemplate, sizeof(bindingTemplate));
  77. bindingTemplate.Version = 1;
  78. bindingTemplate.ProtocolSequence = RPC_PROTSEQ_LRPC;
  79. bindingTemplate.StringEndpoint = NULL;
  80. memcpy_s(&bindingTemplate.ObjectUuid, sizeof(UUID), connectionUuid, sizeof(UUID));
  81. bindingTemplate.Flags |= RPC_BHT_OBJECT_UUID_VALID;
  82. ZeroMemory(&bindingSecurity, sizeof(bindingSecurity));
  83. bindingSecurity.Version = 1;
  84. bindingSecurity.AuthnLevel = RPC_C_AUTHN_LEVEL_PKT_PRIVACY;
  85. bindingSecurity.AuthnSvc = RPC_C_AUTHN_KERNEL;
  86. bindingSecurity.SecurityQos = (RPC_SECURITY_QOS*)&securityQOS;
  87. status = RpcBindingCreate(&bindingTemplate, &bindingSecurity, NULL, &localBindingHandle);
  88. if (status != RPC_S_OK)
  89. {
  90. return HRESULT_FROM_WIN32(status);
  91. }
  92. // We keep attempting to connect to the server with increasing wait intervals in between.
  93. // This will wait close to 5 minutes before it finally gives up.
  94. do
  95. {
  96. DWORD waitStatus;
  97. status = RpcBindingBind(NULL, localBindingHandle, ClientIChakraJIT_v0_0_c_ifspec);
  98. if (status == RPC_S_OK)
  99. {
  100. break;
  101. }
  102. else if (status == EPT_S_NOT_REGISTERED)
  103. {
  104. // The Server side has not finished registering the RPC Server yet.
  105. // We should only breakout if we have reached the max attempt count.
  106. if (attemptCount > 600)
  107. {
  108. break;
  109. }
  110. }
  111. else
  112. {
  113. // Some unknown error occurred. We are not going to retry for arbitrary errors.
  114. break;
  115. }
  116. // When we come to this point, it means the server has not finished registration yet.
  117. // We should wait for a while and then reattempt to bind.
  118. waitStatus = WaitForSingleObject(serverProcessHandle, sleepInterval);
  119. if (waitStatus == WAIT_OBJECT_0)
  120. {
  121. // The server process died for some reason. No need to reattempt.
  122. status = RPC_S_SERVER_UNAVAILABLE;
  123. break;
  124. }
  125. else if (waitStatus == WAIT_TIMEOUT)
  126. {
  127. // Not an error. the server is still alive and we should reattempt.
  128. }
  129. else
  130. {
  131. Assert(waitStatus == WAIT_FAILED);
  132. #ifdef DBG
  133. LPWSTR messageBuffer = nullptr;
  134. DWORD errorNumber = GetLastError();
  135. FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
  136. NULL, errorNumber, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
  137. Output::Print(_u("Last error was 0x%x (%s)"), errorNumber, messageBuffer);
  138. free(messageBuffer);
  139. #endif
  140. // wait operation failed for an unknown reason.
  141. Assert(false);
  142. status = HRESULT_FROM_WIN32(waitStatus);
  143. break;
  144. }
  145. attemptCount++;
  146. if (sleepInterval < 500)
  147. {
  148. sleepInterval += 100;
  149. }
  150. } while (status != RPC_S_OK); // redundant check, but compiler would not allow true here.
  151. *bindingHandle = localBindingHandle;
  152. return HRESULT_FROM_WIN32(status);
  153. }
  154. bool
  155. JITManager::IsJITServer() const
  156. {
  157. return m_isJITServer;
  158. }
  159. void
  160. JITManager::SetIsJITServer()
  161. {
  162. m_isJITServer = true;
  163. m_oopJitEnabled = true;
  164. }
  165. bool
  166. JITManager::IsConnected() const
  167. {
  168. Assert(IsOOPJITEnabled());
  169. return m_rpcBindingHandle != nullptr && !HasJITFailed();
  170. }
  171. void
  172. JITManager::EnableOOPJIT()
  173. {
  174. m_oopJitEnabled = true;
  175. if (CONFIG_FLAG(OOPCFGRegistration))
  176. {
  177. // Since this client has enabled OOPJIT, perform the one-way policy update
  178. // that will disable SetProcessValidCallTargets from being invoked.
  179. GlobalSecurityPolicy::DisableSetProcessValidCallTargets();
  180. }
  181. }
  182. void
  183. JITManager::SetJITFailed(HRESULT hr)
  184. {
  185. Assert(hr != S_OK);
  186. m_failingHRESULT = hr;
  187. }
  188. bool
  189. JITManager::HasJITFailed() const
  190. {
  191. return m_failingHRESULT != S_OK;
  192. }
  193. bool
  194. JITManager::IsOOPJITEnabled() const
  195. {
  196. return m_oopJitEnabled;
  197. }
  198. HRESULT
  199. JITManager::ConnectRpcServer(__in HANDLE jitProcessHandle, __in_opt void* serverSecurityDescriptor, __in UUID connectionUuid)
  200. {
  201. Assert(IsOOPJITEnabled());
  202. if(m_rpcBindingHandle != nullptr)
  203. {
  204. // TODO: change this to allow connecting a new JIT process to new ThreadContexts
  205. return E_FAIL;
  206. }
  207. HRESULT hr = E_FAIL;
  208. if (IsConnected())
  209. {
  210. Assert(UNREACHED);
  211. return E_FAIL;
  212. }
  213. hr = CreateBinding(jitProcessHandle, serverSecurityDescriptor, &connectionUuid, &m_rpcBindingHandle);
  214. if (FAILED(hr))
  215. {
  216. goto FailureCleanup;
  217. }
  218. m_jitConnectionId = connectionUuid;
  219. hr = ConnectProcess();
  220. HandleServerCallResult(hr, RemoteCallType::StateUpdate);
  221. return hr;
  222. FailureCleanup:
  223. if (m_rpcBindingHandle)
  224. {
  225. RpcBindingFree(&m_rpcBindingHandle);
  226. m_rpcBindingHandle = nullptr;
  227. }
  228. return hr;
  229. }
  230. HRESULT
  231. JITManager::Shutdown()
  232. {
  233. // this is special case of shutdown called when runtime process is a parent of the server process
  234. // used for console host type scenarios
  235. HRESULT hr = S_OK;
  236. Assert(IsOOPJITEnabled());
  237. Assert(m_rpcBindingHandle != nullptr);
  238. RpcTryExcept
  239. {
  240. ClientShutdown(m_rpcBindingHandle);
  241. }
  242. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  243. {
  244. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  245. }
  246. RpcEndExcept;
  247. m_rpcBindingHandle = nullptr;
  248. return hr;
  249. }
  250. HRESULT
  251. JITManager::ConnectProcess()
  252. {
  253. Assert(IsOOPJITEnabled());
  254. #ifdef USE_RPC_HANDLE_MARSHALLING
  255. HANDLE processHandle;
  256. if (!DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(), GetCurrentProcess(), &processHandle, 0, false, DUPLICATE_SAME_ACCESS))
  257. {
  258. return false;
  259. }
  260. #endif
  261. HRESULT hr = E_FAIL;
  262. RpcTryExcept
  263. {
  264. hr = ClientConnectProcess(
  265. m_rpcBindingHandle,
  266. #ifdef USE_RPC_HANDLE_MARSHALLING
  267. processHandle,
  268. #endif
  269. (intptr_t)AutoSystemInfo::Data.GetChakraBaseAddr(),
  270. (intptr_t)AutoSystemInfo::Data.GetCRTHandle());
  271. }
  272. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  273. {
  274. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  275. }
  276. RpcEndExcept;
  277. #ifdef USE_RPC_HANDLE_MARSHALLING
  278. CloseHandle(processHandle);
  279. #endif
  280. return hr;
  281. }
  282. HRESULT
  283. JITManager::InitializeThreadContext(
  284. __in ThreadContextDataIDL * data,
  285. __out PPTHREADCONTEXT_HANDLE threadContextInfoAddress,
  286. __out intptr_t * prereservedRegionAddr,
  287. __out intptr_t * jitThunkAddr)
  288. {
  289. Assert(IsOOPJITEnabled());
  290. HRESULT hr = E_FAIL;
  291. RpcTryExcept
  292. {
  293. hr = ClientInitializeThreadContext(
  294. m_rpcBindingHandle,
  295. data,
  296. threadContextInfoAddress,
  297. prereservedRegionAddr,
  298. jitThunkAddr);
  299. }
  300. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  301. {
  302. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  303. }
  304. RpcEndExcept;
  305. return hr;
  306. }
  307. HRESULT
  308. JITManager::CleanupThreadContext(
  309. __inout PPTHREADCONTEXT_HANDLE threadContextInfoAddress)
  310. {
  311. Assert(IsOOPJITEnabled());
  312. HRESULT hr = E_FAIL;
  313. RpcTryExcept
  314. {
  315. hr = ClientCleanupThreadContext(m_rpcBindingHandle, threadContextInfoAddress);
  316. }
  317. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  318. {
  319. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  320. }
  321. RpcEndExcept;
  322. return hr;
  323. }
  324. HRESULT
  325. JITManager::AddDOMFastPathHelper(
  326. __in PSCRIPTCONTEXT_HANDLE scriptContextInfoAddress,
  327. __in intptr_t funcInfoAddr,
  328. __in int helper)
  329. {
  330. Assert(IsOOPJITEnabled());
  331. HRESULT hr = E_FAIL;
  332. RpcTryExcept
  333. {
  334. hr = ClientAddDOMFastPathHelper(m_rpcBindingHandle, scriptContextInfoAddress, funcInfoAddr, helper);
  335. }
  336. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  337. {
  338. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  339. }
  340. RpcEndExcept;
  341. return hr;
  342. }
  343. HRESULT
  344. JITManager::SetIsPRNGSeeded(
  345. __in PSCRIPTCONTEXT_HANDLE scriptContextInfoAddress,
  346. __in boolean value)
  347. {
  348. HRESULT hr = E_FAIL;
  349. RpcTryExcept
  350. {
  351. hr = ClientSetIsPRNGSeeded(m_rpcBindingHandle, scriptContextInfoAddress, value);
  352. }
  353. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  354. {
  355. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  356. }
  357. RpcEndExcept;
  358. return hr;
  359. }
  360. HRESULT
  361. JITManager::DecommitInterpreterBufferManager(
  362. __in PSCRIPTCONTEXT_HANDLE scriptContextInfoAddress,
  363. __in boolean asmJsThunk)
  364. {
  365. Assert(IsOOPJITEnabled());
  366. HRESULT hr = E_FAIL;
  367. RpcTryExcept
  368. {
  369. hr = ClientDecommitInterpreterBufferManager(m_rpcBindingHandle, scriptContextInfoAddress, asmJsThunk);
  370. }
  371. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  372. {
  373. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  374. }
  375. RpcEndExcept;
  376. return hr;
  377. }
  378. HRESULT
  379. JITManager::NewInterpreterThunkBlock(
  380. __in PSCRIPTCONTEXT_HANDLE scriptContextInfoAddress,
  381. __in InterpreterThunkInputIDL * thunkInput,
  382. __out InterpreterThunkOutputIDL * thunkOutput)
  383. {
  384. Assert(IsOOPJITEnabled());
  385. HRESULT hr = E_FAIL;
  386. RpcTryExcept
  387. {
  388. hr = ClientNewInterpreterThunkBlock(m_rpcBindingHandle, scriptContextInfoAddress, thunkInput, thunkOutput);
  389. }
  390. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  391. {
  392. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  393. }
  394. RpcEndExcept;
  395. return hr;
  396. }
  397. HRESULT
  398. JITManager::AddModuleRecordInfo(
  399. /* [in] */ PSCRIPTCONTEXT_HANDLE scriptContextInfoAddress,
  400. /* [in] */ unsigned int moduleId,
  401. /* [in] */ intptr_t localExportSlotsAddr)
  402. {
  403. Assert(IsOOPJITEnabled());
  404. HRESULT hr = E_FAIL;
  405. RpcTryExcept
  406. {
  407. hr = ClientAddModuleRecordInfo(m_rpcBindingHandle, scriptContextInfoAddress, moduleId, localExportSlotsAddr);
  408. }
  409. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  410. {
  411. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  412. }
  413. RpcEndExcept;
  414. return hr;
  415. }
  416. HRESULT
  417. JITManager::SetWellKnownHostTypeId(
  418. __in PTHREADCONTEXT_HANDLE threadContextRoot,
  419. __in int typeId)
  420. {
  421. Assert(IsOOPJITEnabled());
  422. HRESULT hr = E_FAIL;
  423. RpcTryExcept
  424. {
  425. hr = ClientSetWellKnownHostTypeId(m_rpcBindingHandle, threadContextRoot, typeId);
  426. }
  427. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  428. {
  429. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  430. }
  431. RpcEndExcept;
  432. return hr;
  433. }
  434. HRESULT
  435. JITManager::UpdatePropertyRecordMap(
  436. __in PTHREADCONTEXT_HANDLE threadContextInfoAddress,
  437. __in_opt BVSparseNodeIDL * updatedPropsBVHead)
  438. {
  439. Assert(IsOOPJITEnabled());
  440. HRESULT hr = E_FAIL;
  441. RpcTryExcept
  442. {
  443. hr = ClientUpdatePropertyRecordMap(m_rpcBindingHandle, threadContextInfoAddress, updatedPropsBVHead);
  444. }
  445. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  446. {
  447. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  448. }
  449. RpcEndExcept;
  450. return hr;
  451. }
  452. HRESULT
  453. JITManager::InitializeScriptContext(
  454. __in ScriptContextDataIDL * data,
  455. __in PTHREADCONTEXT_HANDLE threadContextInfoAddress,
  456. __out PPSCRIPTCONTEXT_HANDLE scriptContextInfoAddress)
  457. {
  458. Assert(IsOOPJITEnabled());
  459. HRESULT hr = E_FAIL;
  460. RpcTryExcept
  461. {
  462. hr = ClientInitializeScriptContext(m_rpcBindingHandle, data, threadContextInfoAddress, scriptContextInfoAddress);
  463. }
  464. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  465. {
  466. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  467. }
  468. RpcEndExcept;
  469. return hr;
  470. }
  471. HRESULT
  472. JITManager::CleanupScriptContext(
  473. __inout PPSCRIPTCONTEXT_HANDLE scriptContextInfoAddress)
  474. {
  475. Assert(IsOOPJITEnabled());
  476. HRESULT hr = E_FAIL;
  477. RpcTryExcept
  478. {
  479. hr = ClientCleanupScriptContext(m_rpcBindingHandle, scriptContextInfoAddress);
  480. }
  481. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  482. {
  483. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  484. }
  485. RpcEndExcept;
  486. return hr;
  487. }
  488. HRESULT
  489. JITManager::CloseScriptContext(
  490. __in PSCRIPTCONTEXT_HANDLE scriptContextInfoAddress)
  491. {
  492. Assert(IsOOPJITEnabled());
  493. HRESULT hr = E_FAIL;
  494. RpcTryExcept
  495. {
  496. hr = ClientCloseScriptContext(m_rpcBindingHandle, scriptContextInfoAddress);
  497. }
  498. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  499. {
  500. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  501. }
  502. RpcEndExcept;
  503. return hr;
  504. }
  505. HRESULT
  506. JITManager::FreeAllocation(
  507. __in PTHREADCONTEXT_HANDLE threadContextInfoAddress,
  508. __in intptr_t codeAddress)
  509. {
  510. Assert(IsOOPJITEnabled());
  511. HRESULT hr = E_FAIL;
  512. RpcTryExcept
  513. {
  514. hr = ClientFreeAllocation(m_rpcBindingHandle, threadContextInfoAddress, codeAddress);
  515. }
  516. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  517. {
  518. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  519. }
  520. RpcEndExcept;
  521. return hr;
  522. }
  523. HRESULT
  524. JITManager::IsNativeAddr(
  525. __in PTHREADCONTEXT_HANDLE threadContextInfoAddress,
  526. __in intptr_t address,
  527. __out boolean * result)
  528. {
  529. Assert(IsOOPJITEnabled());
  530. HRESULT hr = E_FAIL;
  531. RpcTryExcept
  532. {
  533. hr = ClientIsNativeAddr(m_rpcBindingHandle, threadContextInfoAddress, address, result);
  534. }
  535. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  536. {
  537. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  538. }
  539. RpcEndExcept;
  540. return hr;
  541. }
  542. HRESULT
  543. JITManager::RemoteCodeGenCall(
  544. __in CodeGenWorkItemIDL *workItemData,
  545. __in PSCRIPTCONTEXT_HANDLE scriptContextInfoAddress,
  546. __out JITOutputIDL *jitData)
  547. {
  548. Assert(IsOOPJITEnabled());
  549. HRESULT hr = E_FAIL;
  550. RpcTryExcept
  551. {
  552. hr = ClientRemoteCodeGen(m_rpcBindingHandle, scriptContextInfoAddress, workItemData, jitData);
  553. }
  554. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  555. {
  556. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  557. }
  558. RpcEndExcept;
  559. return hr;
  560. }
  561. #if DBG
  562. HRESULT
  563. JITManager::IsInterpreterThunkAddr(
  564. __in PSCRIPTCONTEXT_HANDLE scriptContextInfoAddress,
  565. __in intptr_t address,
  566. __in boolean asmjsThunk,
  567. __out boolean * result)
  568. {
  569. Assert(IsOOPJITEnabled());
  570. HRESULT hr = E_FAIL;
  571. RpcTryExcept
  572. {
  573. hr = ClientIsInterpreterThunkAddr(m_rpcBindingHandle, scriptContextInfoAddress, address, asmjsThunk, result);
  574. }
  575. RpcExcept(RpcExceptionFilter(RpcExceptionCode()))
  576. {
  577. hr = HRESULT_FROM_WIN32(RpcExceptionCode());
  578. }
  579. RpcEndExcept;
  580. return hr;
  581. }
  582. #endif