diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MESI_CMP_directory-L1cache.sm --- a/src/mem/protocol/MESI_CMP_directory-L1cache.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MESI_CMP_directory-L1cache.sm Fri May 27 13:42:16 2011 -0500 @@ -180,6 +180,7 @@ if (is_valid(cache_entry)) { cache_entry.CacheState := state; + cache_entry.changePermission(L1Cache_State_to_permission(state)); } } diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MESI_CMP_directory-L2cache.sm --- a/src/mem/protocol/MESI_CMP_directory-L2cache.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MESI_CMP_directory-L2cache.sm Fri May 27 13:42:16 2011 -0500 @@ -212,6 +212,7 @@ if (is_valid(cache_entry)) { cache_entry.CacheState := state; + cache_entry.changePermission(L2Cache_State_to_permission(state)); } } diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MESI_CMP_directory-dir.sm --- a/src/mem/protocol/MESI_CMP_directory-dir.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MESI_CMP_directory-dir.sm Fri May 27 13:42:16 2011 -0500 @@ -109,7 +109,7 @@ void set_tbe(TBE tbe); void unset_tbe(); - + Entry getDirectoryEntry(Address addr), return_by_ref="yes" { return static_cast(Entry, directory[addr]); } @@ -142,6 +142,7 @@ } getDirectoryEntry(addr).DirectoryState := state; + getDirectoryEntry(addr).changePermission(Directory_State_to_permission(state)); } } diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MI_example-cache.sm --- a/src/mem/protocol/MI_example-cache.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MI_example-cache.sm Fri May 27 13:42:16 2011 -0500 @@ -117,6 +117,7 @@ if (is_valid(cache_entry)) { cache_entry.CacheState := state; + cache_entry.changePermission(L1Cache_State_to_permission(state)); } } diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MI_example-dir.sm --- a/src/mem/protocol/MI_example-dir.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MI_example-dir.sm Fri May 27 13:42:16 2011 -0500 @@ -107,6 +107,7 @@ } getDirectoryEntry(addr).DirectoryState := state; + getDirectoryEntry(addr).changePermission(Directory_State_to_permission(state)); if (state == State:I) { assert(getDirectoryEntry(addr).Owner.count() == 0); diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MOESI_CMP_directory-L1cache.sm --- a/src/mem/protocol/MOESI_CMP_directory-L1cache.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MOESI_CMP_directory-L1cache.sm Fri May 27 13:42:16 2011 -0500 @@ -186,6 +186,7 @@ ((cache_entry.CacheState != State:O) && (state == State:O)) ) { cache_entry.CacheState := state; + cache_entry.changePermission(L1Cache_State_to_permission(state)); sequencer.checkCoherence(addr); } else { diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MOESI_CMP_directory-L2cache.sm --- a/src/mem/protocol/MOESI_CMP_directory-L2cache.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MOESI_CMP_directory-L2cache.sm Fri May 27 13:42:16 2011 -0500 @@ -493,6 +493,7 @@ else { cache_entry.CacheState := state; } + cache_entry.changePermission(L2Cache_State_to_permission(state)); } else if (localDirectory.isTagPresent(addr)) { localDirectory[addr].DirState := state; diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MOESI_CMP_directory-dir.sm --- a/src/mem/protocol/MOESI_CMP_directory-dir.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MOESI_CMP_directory-dir.sm Fri May 27 13:42:16 2011 -0500 @@ -168,6 +168,8 @@ else { getDirectoryEntry(addr).DirectoryState := state; } + + getDirectoryEntry(addr).changePermission(Directory_State_to_permission(state)); } } diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MOESI_CMP_token-L1cache.sm --- a/src/mem/protocol/MOESI_CMP_token-L1cache.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MOESI_CMP_token-L1cache.sm Fri May 27 13:42:16 2011 -0500 @@ -338,6 +338,7 @@ } cache_entry.CacheState := state; + cache_entry.changePermission(L1Cache_State_to_permission(state)); } } diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MOESI_CMP_token-L2cache.sm --- a/src/mem/protocol/MOESI_CMP_token-L2cache.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MOESI_CMP_token-L2cache.sm Fri May 27 13:42:16 2011 -0500 @@ -208,6 +208,7 @@ } cache_entry.CacheState := state; + cache_entry.changePermission(L2Cache_State_to_permission(state)); } } diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MOESI_CMP_token-dir.sm --- a/src/mem/protocol/MOESI_CMP_token-dir.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MOESI_CMP_token-dir.sm Fri May 27 13:42:16 2011 -0500 @@ -182,6 +182,7 @@ tbe.TBEState := state; } getDirectoryEntry(addr).DirectoryState := state; + getDirectoryEntry(addr).changePermission(Directory_State_to_permission(state)); if (state == State:L || state == State:DW_L || state == State:DR_L) { assert(getDirectoryEntry(addr).Tokens == 0); diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MOESI_hammer-cache.sm --- a/src/mem/protocol/MOESI_hammer-cache.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MOESI_hammer-cache.sm Fri May 27 13:42:16 2011 -0500 @@ -224,6 +224,7 @@ if (is_valid(cache_entry)) { cache_entry.CacheState := state; + cache_entry.changePermission(L1Cache_State_to_permission(state)); } } diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/MOESI_hammer-dir.sm --- a/src/mem/protocol/MOESI_hammer-dir.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/MOESI_hammer-dir.sm Fri May 27 13:42:16 2011 -0500 @@ -231,6 +231,7 @@ assert(is_valid(tbe) == false); } getDirectoryEntry(addr).DirectoryState := state; + getDirectoryEntry(addr).changePermission(Directory_State_to_permission(state)); } Event cache_request_to_event(CoherenceRequestType type) { diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/protocol/RubySlicc_Types.sm --- a/src/mem/protocol/RubySlicc_Types.sm Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/protocol/RubySlicc_Types.sm Fri May 27 13:42:16 2011 -0500 @@ -120,7 +120,9 @@ int contextId, desc="this goes away but must be replace with Nilay"; } -external_type(AbstractEntry, primitive="yes"); +structure (AbstractEntry, primitive="yes", external = "yes") { + void changePermission(AccessPermission); +} structure (DirectoryMemory, external = "yes") { AbstractEntry lookup(Address); @@ -128,7 +130,9 @@ void invalidateBlock(Address); } -external_type(AbstractCacheEntry, primitive="yes"); +structure (AbstractCacheEntry, primitive="yes", external = "yes") { + void changePermission(AccessPermission); +} structure (CacheMemory, external = "yes") { bool cacheAvail(Address); diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/slicc/ast/MethodCallExprAST.py --- a/src/mem/slicc/ast/MethodCallExprAST.py Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/slicc/ast/MethodCallExprAST.py Fri May 27 13:42:16 2011 -0500 @@ -160,7 +160,13 @@ if return_type.isInterface: prefix = "static_cast<%s &>" % return_type.c_ident - prefix = "%s((%s)." % (prefix, code) + + if str(obj_type) == "AbstractCacheEntry" or \ + ("interface" in obj_type and + obj_type["interface"] == "AbstractCacheEntry"): + prefix = "%s((*(%s))." % (prefix, code) + else: + prefix = "%s((%s)." % (prefix, code) return obj_type, methodId, prefix diff -r dda2a88eb7c4 -r 497a6b48741a src/mem/slicc/symbols/StateMachine.py --- a/src/mem/slicc/symbols/StateMachine.py Wed May 25 01:32:07 2011 -0700 +++ b/src/mem/slicc/symbols/StateMachine.py Fri May 27 13:42:16 2011 -0500 @@ -348,8 +348,6 @@ // Set and Reset for cache_entry variable void set_cache_entry(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, AbstractCacheEntry* m_new_cache_entry); void unset_cache_entry(${{self.EntryType.c_ident}}*& m_cache_entry_ptr); -// Set permissions for the cache_entry -void set_permission(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, AccessPermission perm); ''') if self.TBEType != None: @@ -864,15 +862,6 @@ { m_cache_entry_ptr = 0; } - -void -$c_ident::set_permission(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, - AccessPermission perm) -{ - if (m_cache_entry_ptr != NULL) { - m_cache_entry_ptr->changePermission(perm); - } -} ''') if self.TBEType != None: @@ -1116,12 +1105,10 @@ ''') if self.TBEType != None and self.EntryType != None: code('${ident}_setState(m_tbe_ptr, m_cache_entry_ptr, addr, next_state);') - code('set_permission(m_cache_entry_ptr, ${ident}_State_to_permission(next_state));') elif self.TBEType != None: code('${ident}_setState(m_tbe_ptr, addr, next_state);') elif self.EntryType != None: code('${ident}_setState(m_cache_entry_ptr, addr, next_state);') - code('set_permission(m_cache_entry_ptr, ${ident}_State_to_permission(next_state));') else: code('${ident}_setState(addr, next_state);')