Hi, thanks for the reply.
label1: ... some code branch label3 label2: <watchpoint> ... some short op (smaller than maxJumpReplacementSize) label3:
Is there anything which ensures that a watchpoint is always immediately followed by a label, which inserts the nops? So the code layout look always like this: watchpoint - multiple times allowed label - terminate the watchpoints, inserts the nops (btw on ARM we insert one nop like arithmetic instruction and one constant pool entry) wouldn't it be better, if the watchpoint would insert the nops, detects if called again (and no more nops are inserted) and the label would work as it worked before (we could get rid of one label type in this case). The operations performed by inlined labels seems too much at the moment. Regards, Zoltan
On Jun 30, 2012, at 2:18 AM, Zoltan Herczeg wrote:
wouldn't it be better, if the watchpoint would insert the nops, detects if called again (and no more nops are inserted) and the label would work as it worked before (we could get rid of one label type in this case). The operations performed by inlined labels seems too much at the moment.
In practice the space between a watchpoint and the subsequent label is almost never smaller than maxJumpReplacementSize, which means we pretty much never need to emit a nop. The mechanism largely exists as a safety net, to ensure correct behaviour in very unlikely cases. Switching to inserting nops after watchpoints would add a large number of unnecessary instructions to the code. cheers, G.
Hi,
In practice the space between a watchpoint and the subsequent label is almost never smaller than maxJumpReplacementSize, which means we pretty much never need to emit a nop. The mechanism largely exists as a safety net, to ensure correct behaviour in very unlikely cases. Switching to inserting nops after watchpoints would add a large number of unnecessary instructions to the code.
Hm, perhaps I misunderstand the whole concept. If I understand correctly now, you have a sequence of instructions without labels, which you might replace with an optimized block. When this replacement happens, a direct branch to the optimized code is written to the beginning of the instruction sequence, which overwrites the original instructions (so it cannot be restored anymore, which is no problem since the new code should be faster anyway). The optimized code can jump back the original code if necessary. Am I right? Regards, Zoltan
participants (2)
-
Gavin Barraclough
-
Zoltan Herczeg