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)
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)
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:
stack_limit
, @melkyades, - (, EBX), . JIT nativized , , (#whileTrue:/False:), (BTW, - ). , , : (1) - , (2) ( GC) (3) .)
EBX
#whileTrue:/False:
, , :
@1: call CheckEventsEtc ... cmp ESP, [TOS] dec EBX jbe @1
, dec Carry, jbe , ESP EBX . - , .
dec
jbe
ESP