Fix emitInterceptProlog

When the compare was rewritten for the new assembler syntax
it was accidently changed from being a compare of the byte
pointed to by rax, to a compare of the low byte of rax.

I also noticed that by loading the Func* into rax, and doing
a compare against rax[Func::maybeInterceptedOff()] we can
skip a subsequent mov of the Func* into rax.

The code was only slightly broken because we set everything
to be interceptable up front, (if EnableRenameFunction is on)
because we had too many issues with the invalidation code. The
bug was that if the Func happened to be allocated at a multiple
of 256 bytes, it wasnt interceptable.

Also, the existing code looked silly,

  mov  $abcdef45, $eax
  cmp  0, $al

and the new code is smaller.
Esse commit está contido em:
mwilliams
2013-03-13 17:33:45 -07:00
commit de Sara Golemon
commit 731a3fcd23
+2 -4
Ver Arquivo
@@ -2173,13 +2173,11 @@ TranslatorX64::funcPrologue(Func* func, int nPassed) {
TCA
TranslatorX64::emitInterceptPrologue(Func* func) {
TCA start = a.code.frontier;
emitImmReg(a, int64_t(&func->maybeIntercepted()), rax);
a. cmpb (0, al);
emitImmReg(a, int64_t(func), rax);
a. cmpb (0, rax[Func::maybeInterceptedOff()]);
semiLikelyIfBlock(CC_NE, a, [&]{
// Prologues are not really sites for function entry yet; we can get
// here via an optimistic bindCall. Check that the func is as expected.
emitImmReg(a, int64_t(func), rax);
a. cmpq (rax, rStashedAR[AROFF(m_func)]);
{
JccBlock<CC_NZ> skip(a);