What is the memory layout of a code object in V8?

47 views
Skip to first unread message

Mingwei Zhang

unread,
Apr 19, 2018, 5:57:25 PM4/19/18
to v8-users
Hi,

I used gdb with the gdbinit script provided by V8. So I used the command called "jco" with an argument of a JIT code address. So I have two questions listed below:

1) what is the header of each JIT code function?
2) where is the RelocInfo located for each JIT code function?



For 1), I find that before the real code content, there is data structure in size of 0x60 bytes as I use gdb command to see:

0x2d88b5f04300: 0x00000ccaef902889 0x00002a97d2182a09
0x2d88b5f04310: 0x00002a97d2182241 0x00002a97d2182241
0x2d88b5f04320: 0x00002a97d2182619 0x0000080400000000
0x2d88b5f04330: 0x00002a97d21822d1 0x0000000600000147
0x2d88b5f04340: 0x0000000100000000 0xffffffffffffffff
0x2d88b5f04350: 0xffffffff00000000 0x0000000000000000

Looks like the above byte pattern already exist prior to each code chunk. 

0x2d88b5f04301: [Code]
kind = STUB
major_key = CEntryStub
compiler = unknown
Instructions (size = 327)
0x2d88b5f04360     0  55             push rbp
0x2d88b5f04361     1  4889e5         REX.W movq rbp,rsp
0x2d88b5f04364     4  6a06           push 0x6
0x2d88b5f04366     6  6a00           push 0x0
0x2d88b5f04368     8  49ba0143f0b5882d0000 REX.W movq r10,0x2d88b5f04301    ;; object: 0x2d88b5f04301 <Code STUB>
0x2d88b5f04372    12  4152           push r10
......
RelocInfo (size = 29)
0x2d88b5f0436a  embedded object  (0x2d88b5f04301 <Code STUB>)
0x2d88b5f04379  external reference (Isolate::c_entry_fp_address)  (0x42a21a8)
0x2d88b5f04386  external reference (Isolate::context_address)  (0x42a2138)
0x2d88b5f04393  external reference (Isolate::c_function_address)  (0x42a21b8)
......

For 2), looks like the above info does not exist in JIT code page. 

Thanks.

Jakob Gruber

unread,
Apr 20, 2018, 2:42:51 AM4/20/18
to v8-u...@googlegroups.com
Have a look at [0], which describes the memory layout of code objects. The RelocInfo is currently a separate object and Code objects store a pointer to it.

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jakob Gruber

Software Engineer

jgr...@google.com

Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.

    

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.
Reply all
Reply to author
Forward
0 new messages