[Webkit-unassigned] [Bug 91052] JSC: LLInt should auto-generate our cross-platform C++ interpreter

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 20 15:18:09 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=91052





--- Comment #19 from Mark Lam <mark.lam at apple.com>  2012-08-20 15:18:45 PST ---
(In reply to comment #16)
> > OFFLINE_ASM_OPCODE_LABEL(op_create_this)
> >     r0.i = *CAST<intptr_t*>(fp.i8p - 32);                      // this<t0> = cfr.Callee;
> >     r2.i = *CAST<intptr_t*>(r0.i8p + 40);                      // inheritor<t2> = this<t0>.cachedInheritorID;
> 
> I see a couple issues here.
> 
> (1) r0 and r2 are declared to be interpreter-global. This will defeat local register allocation, possibly causing performance problems. Can you test the performance of this interpreter, as compared to the existing .cpp interpreter, and post the results?
> 
> Performance is not a top priority here, but we'd like to pay it some mind.

The pseudo registers do need to be interpreter global because by definition (like CPU regs), they need to carry their state across to subsequent asm "instruction"s.

Will check the performance.

> (2) This code is a bit cryptic. Assembly forces you to be cryptic. But we're auto-generating C++ here, so we can be much more explanatory. For example, when the existing .cpp interpreter wants to read the callee register, it just says "JSFunction* constructor = jsCast<JSFunction*>(callFrame->callee())". Why is that kind of code not possible here? Are we going out of our way to mimic the assembly generated by our assembly back-ends for some reason?

It is cryptic because by the time the backend gets the info, all I know about are registers, offsets, and what operation to perform on them.  For example, I don't have data to tell me that I'm fetching the callee, only that I am to deref the cfr at a certain numeric constant offset and load that value.

> (3) Comments. I tend to agree that this code is cryptic, and could use some explanation. However, the comments are equally cryptic. I don't know what <> annotation means, and I don't know what these numbered t's are. 
> 
> The original code reads:
> 
>     loadp Callee[cfr], t0
> 
> Why can't our C++ code have variables named "cfr", "callee" and "t0", and perform an operation like "Register t0 = cfr[callee]"?

The backend sees:

  loadp [cfr, -32], t0

I could do extra work to recognize that -32 is the offset for callee on the 32 bit version when applied to the cfr.  How much effort do you want to invest in generating more readable code considering that we will rarely have to debug at this level.

As for the comments, I use "this<t0>" to denote a value named "this" stored in register t0.  It's t0 because the comment is a const string written in the context of the asm code.  The backend later maps it to r0.  I could keep it as t0 to make it map better.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list