コード例 #1
0
void WindowsManager::restore(int index)
{
	if (index < 0 || index >= m_closedWindows.count())
	{
		return;
	}

	const ClosedWindow closedWindow = m_closedWindows.at(index);
	int windowIndex = -1;

	if (closedWindow.previousWindow == 0)
	{
		windowIndex = 0;
	}
	else if (closedWindow.nextWindow == 0)
	{
		windowIndex = m_mainWindow->getTabBar()->count();
	}
	else
	{
		const int previousIndex = getWindowIndex(closedWindow.previousWindow);

		if (previousIndex >= 0)
		{
			windowIndex = (previousIndex + 1);
		}
		else
		{
			const int nextIndex = getWindowIndex(closedWindow.nextWindow);

			if (nextIndex >= 0)
			{
				windowIndex = qMax(0, (nextIndex - 1));
			}
		}
	}

	Window *window = new Window(m_isPrivate);
	window->setSession(closedWindow.window);

	m_closedWindows.removeAt(index);

	if (m_closedWindows.isEmpty() && SessionsManager::getClosedWindows().isEmpty())
	{
		emit closedWindowsAvailableChanged(false);
	}

	addWindow(window, DefaultOpen, windowIndex);
}
コード例 #2
0
ファイル: AppBase.cpp プロジェクト: kitschpatrol/Cinder
void AppBase::privateUpdate__()
{
	mFrameCount++;

	// service asio::io_service
	mIo->poll();

	if( getNumWindows() > 0 ) {
		WindowRef mainWin = getWindowIndex( 0 );
		if( mainWin )
			mainWin->getRenderer()->makeCurrentContext();
	}

	mSignalUpdate.emit();

	update();

	mTimeline->stepTo( static_cast<float>( getElapsedSeconds() ) );

	double now = mTimer.getSeconds();
	if( now > mFpsLastSampleTime + mFpsSampleInterval ) {
		//calculate average Fps over sample interval
		uint32_t framesPassed = mFrameCount - mFpsLastSampleFrame;
		mAverageFps = (float)(framesPassed / (now - mFpsLastSampleTime));

		mFpsLastSampleTime = now;
		mFpsLastSampleFrame = mFrameCount;
	}
}
コード例 #3
0
ファイル: WindowsManager.cpp プロジェクト: Onyx47/otter
void WindowsManager::closeWindow(Window *window)
{
	const int index = getWindowIndex(window);

	if (index < 0)
	{
		return;
	}

	if (window && !window->isPrivate())
	{
		const WindowHistoryInformation history = window->getContentsWidget()->getHistory();

		if (!window->isUrlEmpty() || history.entries.count() > 1)
		{
			const SessionWindow information = window->getSession();

			if (window->getType() != QLatin1String("web"))
			{
				removeStoredUrl(information.getUrl());
			}

			m_closedWindows.prepend(information);

			emit closedWindowsAvailableChanged(true);
		}
	}

	if (m_tabBar->count() == 1)
	{
		window = getWindow(0);

		if (window)
		{
			window->clear();

			return;
		}
	}

	m_tabBar->removeTab(index);

	emit windowRemoved(index);

	if (m_tabBar->count() < 1)
	{
		open();
	}
}
コード例 #4
0
ファイル: controlop.C プロジェクト: dberc/tpzsimul.gems
//**************************************************************************
void 
control_inst_t::Squash() { 
  ASSERT( !getEvent( EVENT_FINALIZED ) );
  ASSERT(m_stage != RETIRE_STAGE);
  if (Waiting()) {
    RemoveWaitQueue();
  }
  UnwindRegisters( );
  m_pseq->decrementSequenceNumber(m_proc);  

  markEvent( EVENT_FINALIZED );
#ifdef PIPELINE_VIS
  m_pseq->out_log("squash %d\n", getWindowIndex());
#endif
}
コード例 #5
0
void WindowsManager::setTitle(const QString &title)
{
	QString text = (title.isEmpty() ? tr("Empty") : title);
	Window *window = qobject_cast<Window*>(sender());

	if (!window)
	{
		return;
	}

	const int index = getWindowIndex(window->getIdentifier());

	if (index == m_mainWindow->getTabBar()->currentIndex())
	{
		emit windowTitleChanged(text);
	}

	m_mainWindow->getTabBar()->setTabText(index, text.replace(QLatin1Char('&'), QLatin1String("&&")));
}
コード例 #6
0
ファイル: WindowsManager.cpp プロジェクト: rejdi/otter
void WindowsManager::closeWindow(Window *window)
{
	const int index = getWindowIndex(window);

	if (index < 0)
	{
		return;
	}

	if (window && !window->isPrivate())
	{
		const WindowHistoryInformation history = window->getContentsWidget()->getHistory();

		if (!window->isUrlEmpty() || history.entries.count() > 1)
		{
			const SessionWindow information = window->getSession();

			if (window->getType() != QLatin1String("web"))
			{
				removeStoredUrl(information.getUrl());
			}

			m_closedWindows.prepend(information);

			emit closedWindowsAvailableChanged(true);
		}
	}

	const QString lastTabClosingAction = SettingsManager::getValue(QLatin1String("TabBar/LastTabClosingAction")).toString();

	if (m_tabBar->count() == 1)
	{
		if (lastTabClosingAction == QLatin1String("closeWindow"))
		{
			ActionsManager::triggerAction(QLatin1String("CloseWindow"), m_mdi);

			return;
		}

		if (lastTabClosingAction == QLatin1String("openTab"))
		{
			window = getWindow(0);

			if (window)
			{
				window->clear();

				return;
			}
		}
		else
		{
			ActionsManager::getAction(QLatin1String("CloneTab"), m_mdi)->setEnabled(false);

			emit windowTitleChanged(QString());
		}
	}

	m_tabBar->removeTab(index);

	emit windowRemoved(index);

	if (m_tabBar->count() < 1 && lastTabClosingAction != QLatin1String("doNothing"))
	{
		open();
	}
}
コード例 #7
0
void WindowsManager::handleWindowClose(Window *window)
{
	const int index = (window ? getWindowIndex(window->getIdentifier()) : -1);

	if (index < 0)
	{
		return;
	}

	if (window && !window->isPrivate())
	{
		const WindowHistoryInformation history = window->getContentsWidget()->getHistory();

		if (!Utils::isUrlEmpty(window->getUrl()) || history.entries.count() > 1)
		{
			Window *nextWindow = getWindowByIndex(index + 1);
			Window *previousWindow = ((index > 0) ? getWindowByIndex(index - 1) : NULL);

			ClosedWindow closedWindow;
			closedWindow.window = window->getSession();
			closedWindow.nextWindow = (nextWindow ? nextWindow->getIdentifier() : 0);
			closedWindow.previousWindow = (previousWindow ? previousWindow->getIdentifier() : 0);

			if (window->getType() != QLatin1String("web"))
			{
				removeStoredUrl(closedWindow.window.getUrl());
			}

			m_closedWindows.prepend(closedWindow);

			emit closedWindowsAvailableChanged(true);
		}
	}

	const QString lastTabClosingAction = SettingsManager::getValue(QLatin1String("Interface/LastTabClosingAction")).toString();

	if (m_mainWindow->getTabBar()->count() == 1)
	{
		if (lastTabClosingAction == QLatin1String("closeWindow") || (lastTabClosingAction == QLatin1String("closeWindowIfNotLast") && SessionsManager::getWindows().count() > 1))
		{
			m_mainWindow->triggerAction(ActionsManager::CloseWindowAction);

			return;
		}

		if (lastTabClosingAction == QLatin1String("openTab"))
		{
			window = getWindowByIndex(0);

			if (window)
			{
				window->clear();

				return;
			}
		}
		else
		{
			m_mainWindow->getAction(ActionsManager::CloseTabAction)->setEnabled(false);
			m_mainWindow->setCurrentWindow(NULL);

			emit windowTitleChanged(QString());
		}
	}

	m_mainWindow->getTabBar()->removeTab(index);

	Action *closePrivateTabsAction = m_mainWindow->getAction(ActionsManager::ClosePrivateTabsAction);

	if (closePrivateTabsAction->isEnabled() && getWindowCount(true) == 0)
	{
		closePrivateTabsAction->setEnabled(false);
	}

	emit windowRemoved(window->getIdentifier());

	m_windows.remove(window->getIdentifier());

	if (m_mainWindow->getTabBar()->count() < 1 && lastTabClosingAction == QLatin1String("openTab"))
	{
		open();
	}
}
コード例 #8
0
ファイル: controlop.C プロジェクト: dberc/tpzsimul.gems
//**************************************************************************
void 
control_inst_t::Execute()
{
  STAT_INC( m_pseq->m_stat_control_exec[m_proc] );
  m_event_times[EVENT_TIME_EXECUTE_DONE] = m_pseq->getLocalCycle() - m_fetch_cycle;

  // call the appropriate function
  static_inst_t *si = getStaticInst();

  char buf[128];
  s->printDisassemble(buf);

  if (true) {

     #ifdef DEBUG_DYNAMIC
        char buf[128];
        s->printDisassemble(buf);
        DEBUG_OUT("[ %d ] control_inst_t: EXECUTE %s NAV[ %d ] seqnum[ %lld ] fetched[ %lld ] cycle[ %lld ]", m_pseq->getID(), buf, getInstrNAV(), seq_num, m_fetch_cycle, m_pseq->getLocalCycle());
        //print source and dest regs
        DEBUG_OUT(" SOURCES: ");
        for(int i=0; i < SI_MAX_SOURCE; ++i){
          reg_id_t & source = getSourceReg(i);
          if(!source.isZero()){
            DEBUG_OUT("( [%d] V: %d P: %d Arf: %s WriterSN: %lld WrittenCycle: %lld State: 0x%x)", i,source.getVanilla(), source.getPhysical(), source.rid_type_menomic( source.getRtype() ), source.getARF()->getWriterSeqnum( source, m_proc ), source.getARF()->getWrittenCycle( source, m_proc ), source.getVanillaState() );
          }
        }
        DEBUG_OUT(" DESTS: ");
        for(int i=0; i < SI_MAX_DEST; ++i){
          reg_id_t & dest = getDestReg(i);
          if(!dest.isZero()){
            DEBUG_OUT("( [%d] V: %d P: %d Arf: %s )", i,dest.getVanilla(), dest.getPhysical(), dest.rid_type_menomic( dest.getRtype() ));
          }
        }
        DEBUG_OUT("\n");
     #endif

    // execute the instruction using the jump table
    pmf_dynamicExecute pmf = m_jump_table[si->getOpcode()];
    (this->*pmf)();

     // Due to functional bugs sometimes m_actual.pc will be -1
     //ASSERT( m_actual.pc != (my_addr_t) -1 );

  } else {
    // NOT executed!
    dp_control_t dp_value;
    dp_value.m_at      = &m_actual;
    dp_value.m_taken   = false;
    dp_value.m_annul   = si->getAnnul();
    dp_value.m_offset  = si->getOffset();

    // do the operation
    exec_fn_execute( (i_opcode) si->getOpcode(), (dp_int_t *) &dp_value );
    
    // write result back to this dynamic instruction
    m_isTaken = dp_value.m_taken;
  }

  SetStage(COMPLETE_STAGE);

  #ifdef DEBUG_DYNAMIC
     char buf[128];
     s->printDisassemble(buf);
     DEBUG_OUT("control_inst_t: AFTER Execute %s NAV[ %d ] seqnum[ %lld ] fetched[ %lld ] cycle[ %lld ] PredPC[ 0x%llx ] ActualPC[ 0x%llx ] PredNPC[ 0x%llx ] ActualNPC[ 0x%llx ] PredCWP[ 0x%x ] ActualCWP[ 0x%x ] PredTL[ 0x%x ] ActualTL[ 0x%x ] PredPstate[ 0x%x ] ActualPstate[ 0x%x ]\n", buf, getInstrNAV(), seq_num, m_fetch_cycle, m_pseq->getLocalCycle(), m_predicted.pc, m_actual.pc, m_predicted.npc, m_actual.npc, m_predicted.cwp, m_actual.cwp, m_predicted.tl, m_actual.tl, m_predicted.pstate, m_actual.pstate);
  #endif

      
  // All control op should be checked, all of them can mis-predict
  // if the predicted PC, nPC pairs don't match with actual, cause exeception
  if ( (m_predicted.pc     != m_actual.pc ||
        m_predicted.npc    != m_actual.npc ||
        m_predicted.cwp    != m_actual.cwp ||
        m_predicted.tl     != m_actual.tl ||
        m_predicted.pstate != m_actual.pstate) ) {
    /* There was a branch mis-prediction --
     *    patch up branch predictor state */

     #ifdef DEBUG_DYNAMIC
         char buf[128];
         s->printDisassemble(buf);
         DEBUG_OUT("[ %d ] control_inst_t: MISPREDICT %s NAV[ %d ] seqnum[ %lld ] fetched[ %lld ] cycle[ %lld ] PredPC[ 0x%llx ] ActualPC[ 0x%llx ] PredNPC[ 0x%llx ] ActualNPC[ 0x%llx ] PredCWP[ 0x%x ] ActualCWP[ 0x%x ] PredTL[ 0x%x ] ActualTL[ 0x%x ] PredPstate[ 0x%x ] ActualPstate[ 0x%x ]\n", m_pseq->getID(), buf, getInstrNAV(), seq_num, m_fetch_cycle, m_pseq->getLocalCycle(), m_predicted.pc, m_actual.pc, m_predicted.npc, m_actual.npc, m_predicted.cwp, m_actual.cwp, m_predicted.tl, m_actual.tl, m_predicted.pstate, m_actual.pstate);
     #endif

    // This preformatted debugging information is left for your convenience
    // NOT very useful here, bc this might indicate a misprediction AFTER another misprediction
    // print this out inside Retire()!
    /*
    char buf[128];
    s->printDisassemble( buf );
      if (m_predicted.cwp != m_actual.cwp) {
      m_pseq->out_info("CONTROLOP: CWP mispredict: predicted[ %d ] actual[ %d ] type=%s seqnum[ %lld ]  VPC[ 0x%llx ] PC[ 0x%llx ] fetched[ %lld ] executed[ %lld ] correctPC[ 0x%llx ] %s\n",
      m_predicted.cwp, m_actual.cwp, pstate_t::branch_type_menomic[s->getBranchType()], seq_num, getVPC(), getPC(), m_fetch_cycle, m_event_times[EVENT_TIME_EXECUTE] + m_fetch_cycle, m_actual.pc, buf);
      }
      if (m_predicted.tl != m_actual.tl) {
      m_pseq->out_info("CONTROLOP: TL mispredict: predicted[ %d ] actual[ %d ] type=%s seqnum[ %lld ] VPC[ 0x%llx ] PC[ 0x%llx ] fetched[ %lld ] executed[ %lld ] correctPC[ 0x%llx ] %s\n",
      m_predicted.tl, m_actual.tl, pstate_t::branch_type_menomic[s->getBranchType()], seq_num, getVPC(), getPC(), m_fetch_cycle, m_event_times[EVENT_TIME_EXECUTE] + m_fetch_cycle, m_actual.pc, buf);
      }
      if (m_predicted.pstate != m_actual.pstate) {
      m_pseq->out_info("CONTROLOP: PSTATE mispredict: predicted[ 0x%0x ] actual[ 0x%0x ] type=%s seqnum[ %lld ] VPC[ 0x%llx ] PC[ 0x%llx ] fetched[ %lld ] executed[ %lld ] correctPC[ 0x%llx ] %s\n",
      m_predicted.pstate, m_actual.pstate, pstate_t::branch_type_menomic[s->getBranchType()], seq_num, getVPC(), getPC(), m_fetch_cycle,  m_event_times[EVENT_TIME_EXECUTE] + m_fetch_cycle, m_actual.pc, buf);
      }
    
    */

    markEvent(EVENT_BRANCH_MISPREDICT);
    if (s->getBranchType()      == BRANCH_COND ||
        s->getBranchType()      == BRANCH_PCOND ) {
      // flip the last bit of the history to correct the misprediction
      m_pred_state.cond_state = m_pred_state.cond_state ^ 1;
        
    } else if (s->getBranchType() == BRANCH_INDIRECT ||
               (s->getBranchType() == BRANCH_CALL && s->getOpcode() != i_call) ) {
      /*
        m_pseq->out_info(" INDIRECT:  predicted 0x%0llx, 0x%0llx\n",
        m_predicted.pc, m_predicted.npc);
        m_pseq->out_info(" INDIRECT:  actual    0x%0llx, 0x%0llx\n",
        m_actual.pc, m_actual.npc);
      */
      m_pseq->getIndirectBP()->FixupState(&(m_pred_state.indirect_state), 
                                          getVPC());
    }
    // no predictor fixup on PRIV, TRAP or TRAP_RETURN right now
    
    // TASK: should update the BTB here
    
    // TASK: determine the fetch location (and state)
    
    m_actual.gset = pstate_t::getGlobalSet( m_actual.pstate );
    
    /* cause a branch misprediction exception */
    m_pseq->raiseException(EXCEPT_MISPREDICT, getWindowIndex(),
                           (enum i_opcode) s->getOpcode(),
                           &m_actual, 0, BRANCHPRED_MISPRED_PENALTY, m_proc );
  }
}