void JitBlockCache::FinalizeBlock(int block_num, bool block_link) { JitBlock &b = blocks_[block_num]; b.originalFirstOpcode = Memory::Read_Opcode_JIT(b.originalAddress); MIPSOpcode opcode = GetEmuHackOpForBlock(block_num); Memory::Write_Opcode_JIT(b.originalAddress, opcode); AddBlockMap(block_num); u32 latestExit = 0; if (block_link) { for (int i = 0; i < MAX_JIT_BLOCK_EXITS; i++) { if (b.exitAddress[i] != INVALID_EXIT) { links_to_.insert(std::make_pair(b.exitAddress[i], block_num)); latestExit = std::max(latestExit, b.exitAddress[i]); } } LinkBlock(block_num); LinkBlockExits(block_num); } if (Memory::IsScratchpadAddress(b.originalAddress)) { ExpandRange(blockMemRanges_[JITBLOCK_RANGE_SCRATCH], b.originalAddress, latestExit); } const u32 halfUserMemory = (PSP_GetUserMemoryEnd() - PSP_GetUserMemoryBase()) / 2; if (b.originalAddress < PSP_GetUserMemoryBase() + halfUserMemory) { ExpandRange(blockMemRanges_[JITBLOCK_RANGE_RAMBOTTOM], b.originalAddress, latestExit); } if (latestExit > PSP_GetUserMemoryBase() + halfUserMemory) { ExpandRange(blockMemRanges_[JITBLOCK_RANGE_RAMTOP], b.originalAddress, latestExit); } #if defined USE_OPROFILE && USE_OPROFILE char buf[100]; sprintf(buf, "EmuCode%x", b.originalAddress); const u8* blockStart = blocks_[block_num].checkedEntry; op_write_native_code(agent, buf, (uint64_t)blockStart, blockStart, b.normalEntry + b.codeSize - b.checkedEntry); #endif #ifdef USE_VTUNE sprintf(b.blockName, "EmuCode_0x%08x", b.originalAddress); iJIT_Method_Load jmethod = {0}; jmethod.method_id = iJIT_GetNewMethodID(); jmethod.class_file_name = ""; jmethod.source_file_name = __FILE__; jmethod.method_load_address = (void*)blocks_[block_num].checkedEntry; jmethod.method_size = b.normalEntry + b.codeSize - b.checkedEntry; jmethod.line_number_size = 0; jmethod.method_name = b.blockName; iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod); #endif }
TEST(MAIN, RangeExpand){ Range one(V3f(0,0,0), V3f(1,1,1)); //start const V3f pnt(100, -100, -100); const V3f out(100.1, -100.1, -100.1); const V3f in(99.9, -99.9, -99.9); Range expanded( (ExpandRange(one, pnt)) ); EXPECT_TRUE(ContainsPoint(expanded, pnt)); EXPECT_FALSE(ContainsPoint(expanded, out)); EXPECT_TRUE(ContainsPoint(expanded, in)); };
void uwTreeList::ExpandRange( const wxTreeItemId& parent, int sublevels ) { if( parent.IsOk() ) { Expand(parent); if( sublevels > 0 ) { wxTreeItemIdValue cookie = 0; wxTreeItemId child = GetFirstChild(parent, cookie); while( child.IsOk() ) { ExpandRange(child,sublevels-1); child = GetNextChild(parent, cookie); } } } }