JIT code and metadata

34 views
Skip to first unread message

Martin Krištien

unread,
Jul 31, 2023, 4:51:50 AM7/31/23
to v8-dev
Hi,

I am exploring V8 JIT code generation as part of my PhD research and I've observed that dynamic code often shares heap space with various metadata. I wish to understand the access pattern for the metadata and its potential impact on code execution performance (i.e. potentially polluting the instruction cache on the host machine).

Could somebody please help me with this or point me to a documentation where I can learn more?

What kind of metadata is stored with the Code objects?
When is it accessed? (reads/writes?)
What kind of application would stress a heavy use of the metadata? (i.e. micro-benchmark?)

Thanks,
Martin


Leszek Swirski

unread,
Jul 31, 2023, 6:38:13 AM7/31/23
to v8-...@googlegroups.com
Hi Martin,

We've recently had a lot of work and refactorings around this topic, which has resulted in a de-facto split of code into Code objects (containing the majority metadata pointers, crsrc.org/c/v8/src/objects/code.h) and InstructionStream objects (containing the actual assembly, relocation information, and I think copies of some of the metadata pointers, crsrc.org/c/v8/src/objects/instruction-stream.h).

In the default configuration, InstructionStreams are allocated in a different space to Code objects (in "external code space"), outside of the main V8 sandbox, so your base assumption around sharing heap space doesn't apply; the reason for this is, among other things, specifically to avoid writes near the instruction stream.

If you want to stress writes to the instruction streams, I think a decent approach is to stress moving GC with `--stress-compation`.

Hope that helps.

- Leszek

--
--
v8-dev mailing list
v8-...@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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/f78d9146-4649-4679-9ee5-e2bbfb53ae09n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages