Hi!
Trying to understand how  put_global_var is translated to x86_64 native code. But still have several questions
Lets say i have following bytecode instruction
put_global_var 4, Int32: 6(@k1)
Lets look at the source code
void JIT::emit_op_put_global_var(Instruction* currentInstruction)
{
    JSGlobalObject* globalObject = m_codeBlock->globalObject();

    emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);

    move(TrustedImmPtr(globalObject), regT1);
    loadPtr(Address(regT1, JSVariableObject::offsetOfRegisters()), regT1);
    storePtr(regT0, Address(regT1, currentInstruction[1].u.operand * sizeof(Register)));
    emitWriteBarrier(globalObject, regT0, regT2, ShouldFilterImmediates, WriteBarrierForVariableAccess);
}

1.  What is mean of currentInstruction[2]?  As I Understand it's holds information about "Int32: 6(@k1)". Am I right??

2.  As I understand  after emitGetVirtualRegister(currentInstruction[2].u.operand, regT0) we have encoded value of "Int32: 6(@k1)" in regT0.

3.  Cant't understad mean of  move(TrustedImmPtr(globalObject), regT1). globalObject is a pretty big class. Can't figure out what is happening here

4.  loadPtr(Address(regT1, JSVariableObject::offsetOfRegisters()), regT1); // What the mean of JSVariableObject::offsetOfRegisters()??

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?

And question about mov instruction on x86_64 platform
 
JSC::X86Assembler::movq_i64r 

void movq_i64r(int64_t imm, RegisterID dst)                                                                                                                                                     
           {                                                                                                                                                                                                 
              m_formatter.oneByteOp64(OP_MOV_EAXIv, dst);                                                                                                                       
              m_formatter.immediate64(imm);                                                                                       
          }   

How will look appropriate assembly for this code??


Thanks for attention!!