How are events viewed by JIT compilers of different virtual machines of a process?

Note. . This question is asked by VM developers of languages ​​such as Smalltalk, Self, Javascript, Java, C #, etc.

The usual functionality provided by the JIT compiler is to automatically view system events. This is used both for handling user interface events and for launching the GC.

Usually this peeking event consists in performing a check when building a frame (when calling methods) and in backjumps. I wondered,

What are the different ways to implement this check? What are their advantages and disadvantages? Do you know any article describing these methods?

Could you tell us how it is implemented in a specific virtual machine? (Pharo, HPS, HotSpot, V8, SpiderMonkey, CLR)

+4
source share
2 answers

From what I read, I assume that each implementation makes some changes:

  • The purpose of the hardware register is specifically for counting and peeping when a certain threshold value is reached. Upsides: Verification is very fast. Disadvantages: you lose the register, which can be better used, the account may be inaccurate / meaningless.

  • Having a timer that is periodically signaled (how will it be implemented?), And then:

    • Moving a variable stack_limit, which is then checked when creating a frame and backjumps
    • (.. ), backjumps. . : , - . : , , . Safepoints : , , , , .
+2

, @melkyades, - (, EBX), . JIT nativized , , (#whileTrue:/False:), (BTW, - ). , , : (1) - , (2) ( GC) (3) .)

, , :

@1: call CheckEventsEtc
    ...
    cmp ESP, [TOS]
    dec EBX
    jbe @1

, dec Carry, jbe , ESP EBX . - , .

+2

All Articles