Hello,
I am wondering how the Pharo VM and Cogit manage the JIT code zone and have several questions related to that! I will ask my questions and what could be the answers, feel free to correct me!
Context: I would like to secure this part of the VM, instrument accesses to it and experiment with changes in its layout/location!
Initialization:
The allocation is made through the succession of: allocateMemoryForImage:withHeader: then allocateMemory:desiredPosition:. The initialization is made through initializeCodeZoneFrom:upTo: where trampolines, PIC prototypes and offsets are generated/computed.
Trampolines and methods/inline caches coexist, trampolines being the first thing generated.
Runtime:
The compiler processes bytecodes at the granularity of a method, using outputInstructionsForGeneratedRuntimeAt: or outputInstructionsAt:. It instruments the actual write with enableCodeZoneWriteDuring:flushingCacheWith:. This step only needs write accesses to the method zone region (after the trampolines).
Marking with mapMachineCode: and compaction compactCogCompiledCode are the two ways the GC temper with machine code. While the first one only needs to read data, the second needs both read and write accesses.
I guess the trampolines ceEnterCogCodePopReceiverReg and ceReturnToInterpreter: are the main bridges between both worlds.
Bonus: What is the difference between Cogit and the CoInterpreter?
Thanks in advance for the answers!
| Quentin Ducasse Doctorant / PhD Student Lab-STICC ��� UMR CNRS 6285 www.labsticc.fr
ENSTA Bretagne Grande ��cole d'ing��nieurs et centre de recherche French State Graduate, Post-Graduate and Research Institute 2 rue Fran��ois Verny - 29806 Brest Cedex 9 - France www.ensta-bretagne.fr
|