<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">wingoog moon</b> <span dir="ltr"><<a href="mailto:wingoog91@gmail.com">wingoog91@gmail.com</a>></span><br>
Date: Wed, Feb 22, 2012 at 1:50 AM<br>Subject: Native code generation for put_global_var instruction on X86_64 platform<br>To: <a href="mailto:squirrelfish-dev@lists.webkit.org">squirrelfish-dev@lists.webkit.org</a><br><br>
<br>Hi!<div>Trying to understand how  put_global_var is translated to x86_64 native code. But still have several questions</div><div>Lets say i have following bytecode instruction</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">

<div>put_global_var<span style="white-space:pre-wrap">    </span> 4, Int32: 6(@k1)</div></blockquote><div>Lets look at the source code</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>
<div>void JIT::emit_op_put_global_var(Instruction* currentInstruction)</div><div>{</div><div>    JSGlobalObject* globalObject = m_codeBlock->globalObject();</div><div><br></div><div>    emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);</div>

<div><br></div><div>    move(TrustedImmPtr(globalObject), regT1);</div><div>    loadPtr(Address(regT1, JSVariableObject::offsetOfRegisters()), regT1);</div><div>    storePtr(regT0, Address(regT1, currentInstruction[1].u.operand * sizeof(Register)));</div>

<div>    emitWriteBarrier(globalObject, regT0, regT2, ShouldFilterImmediates, WriteBarrierForVariableAccess);</div><div>}</div></div><div><br></div></blockquote>1.  What is mean of currentInstruction[2]?  As I Understand it's holds information about "Int32: 6(@k1)". Am I right??<div>

<br></div><div>2.  As I understand  after emitGetVirtualRegister(currentInstruction[2].u.operand, regT0) we have encoded value of "Int32: 6(@k1)" in regT0.</div><div><br></div><div>3.  Cant't understad mean of  move(TrustedImmPtr(globalObject), regT1). globalObject is a pretty big class. Can't figure out what is happening here</div>

<div><br></div><div>4.  loadPtr(Address(regT1, JSVariableObject::offsetOfRegisters()), regT1); // What the mean of JSVariableObject::offsetOfRegisters()??</div><div><br></div><div>5.   storePtr(regT0, Address(regT1, currentInstruction[1].u.operand * sizeof(Register))); // As I understand currentInstruction[1].u.operand holds address where to put my constant, i.e "4". Am I right?</div>

<div><br></div><div>And question about mov instruction on x86_64 platform</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div> </div><div>JSC::X86Assembler::movq_i64r </div></blockquote><div><br></div>

<div>void movq_i64r(int64_t imm, RegisterID dst)                                                                                                                                                     </div><div>           {                                                                                                                                                                                                 </div>

<div>              m_formatter.oneByteOp64(OP_MOV_EAXIv, dst);                                                                                                                       </div><div>              m_formatter.immediate64(imm);                                                                                       </div>

<div>          }   </div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><br></div><div>How will look appropriate assembly for this code??</div><div><br></div></blockquote><div><br></div>Thanks for attention!!
</div><br>