Skip to content

Commit

Permalink
[msvc] implement symbols without inline assembly
Browse files Browse the repository at this point in the history
MSVC does not support inline assembly (clang-cl does).

Those two functions needs to be implemented using C++ only. Implemented
a version for MSVC only, based on an intrinsic (that guarantees load,
even with optimization) available for any architecture.

Bug: v8:13312
Change-Id: I3aa4eac03c099535c5d3a9a40221bd5f8bbcb0d1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913036
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83407}
  • Loading branch information
pbo-linaro authored and V8 LUCI CQ committed Sep 23, 2022
1 parent 7ddb839 commit b161a08
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/trap-handler/handler-outside-simulator.cc
Expand Up @@ -11,6 +11,17 @@
#define SYMBOL(name) #name
#endif // !V8_OS_DARWIN

#if defined(_MSC_VER) && !defined(__clang__)
// MSVC does not accept inline assembly
#include <intrin.h>
extern "C" uintptr_t ProbeMemory(uintptr_t address, uintptr_t pc) {
// @pc parameter is unused.
// This intrinsic guarantees that a load from address will be done.
__iso_volatile_load8(reinterpret_cast<char*>(address));
return 0;
}
extern "C" void v8_probe_memory_continuation() {}
#else
// Define the ProbeMemory function declared in trap-handler-simulators.h.
asm(
".globl " SYMBOL(ProbeMemory) " \n"
Expand All @@ -35,3 +46,4 @@ asm(
SYMBOL(v8_probe_memory_continuation) ": \n"
// If the trap handler continues here, it wrote the landing pad in %rax.
" ret \n");
#endif

0 comments on commit b161a08

Please sign in to comment.