We recently discovered an interesting result of LTO, whereby 
Isolate::Initialize() was failing where it checks that the platform's 
foreground task runner has non-nestable tasks enabled: 
https://source.chromium.org/chromium/chromium/src/+/main:v8/src/api/api.cc;l=8690-8696?q=Isolate::Initi&ss=chromium

Despite our implementation returning true, the check was still failing. 
 After some investigation it turned out that within the dll that houses 
Chromium, LTO had kicked in and turned the virtual call into simple 
load: 
https://github.com/llvm/llvm-project/blob/release/13.x/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp#L14-L18

As our implementation or v8::TaskRunner lives outside of this dll, it 
wasn't generated with this extra slot for the value next to its vtable, so 
at runtime Isolate::Initialize() was loading garbage and thus the check was 
failing.

It seems that the fix is to mark the v8::TaskRunner class as V8_EXPORT so 
that LTO doesn't apply: https://clang.llvm.org/docs/LTOVisibility.html

Is there any reason these weren't marked already?  If not, I'm happy to 
submit a patch.

Thanks,
Daryl.

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/5121dc21-9ad7-4bcf-b8ba-aa3964bdcf53n%40googlegroups.com.

Reply via email to