[Gems-users] Ruby-Opal interface


Date: Thu, 15 Sep 2005 21:30:13 -0700 (PDT)
From: "Gilles Pokam" <gpokam@xxxxxxxxxxx>
Subject: [Gems-users] Ruby-Opal interface
Hi,

I have a question regarding the Ruby/Opal interface, more particularly the
way Ruby communicates with Opal.

There is this piece of code taking from the file rubycache.C (access
function) that I'm trying to understand.

#ifndef FAKE_RUBY
#ifdef  DEBUG_RUBY
     if (requestType != X86_IFETCH) {
       DEBUG("[%d] rubycache:: access %s 0x%0llx\n", m_id,
                 memop_menomic(requestType), la_t lineaddr );
       print();
     }
 #endif

     // ruby may call opal api to change m_fastpath_hit's value
     (*ruby_api->makeRequest)( m_id, lineaddr, m_block_size,
                               requestType, vpc, priv );
 #else
     // complete the request about 25% of the time
     if ( random() % 4 == 0 ) {
       complete( lineaddr );
     }
 #endif

     if ( m_fastpath_hit ) {
       // hit in fast path
       return HIT;
     }

 First, could someone explain to me what the FAKE_RUBY macro does ?
 Now, assume this macro has not been defined anyway, meaning that the
 makeRequest call gets executed. What I don't understand is the comment
 just near the code saying that ruby may call opal api to change
 m_fastpath_hit's value. Indeed, the m_fastpath_hit is tested just at the
 end of the macro. I'v tried to look in Ruby's code where this variable
 actually gets modified but I was not successful. Could you please
 point me in Ruby's code where this variable gets modified ?

 Thanks.

[← Prev in Thread] Current Thread [Next in Thread→]