Exemplo n.º 1
0
void HHChannel2D::setZindex( string Zindex )
{
	if ( Zindex == Zindex_ )
		return;

	Zindex_ = Zindex;
	Zdep0_ = dependency( Zindex, 0 );
	Zdep1_ = dependency( Zindex, 1 );
	
	assert( Zdep0_ >= 0 );
}
Exemplo n.º 2
0
void HHChannel2D::setYindex( string Yindex )
{
	if ( Yindex == Yindex_ )
		return;
	
	Yindex_ = Yindex;
	Ydep0_ = dependency( Yindex, 0 );
	Ydep1_ = dependency( Yindex, 1 );
	
	assert( Ydep0_ >= 0 );
}
Exemplo n.º 3
0
void HHChannel2D::setXindex( string Xindex )
{
	if ( Xindex == Xindex_ )
		return;

	Xindex_ = Xindex;
	Xdep0_ = dependency( Xindex, 0 );
	Xdep1_ = dependency( Xindex, 1 );
	
	assert( Xdep0_ >= 0 );
}
TBool CIAUpdateNodeDetails::EmbededDegrades() const
    {
    IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeDetails::EmbededDegrades() begin");
    
    for ( TInt i = 0; i < iDependencies.Count(); ++i )
        {
        CIAUpdateNodeDependency* dependency( iDependencies[ i ] );
        if ( dependency->IsEmbedded() )
            {
            // Because the dependency is embedded 
            // we have to make sure that embedding does not
            // create downgrading.
            TBool installed( EFalse );
            TIAUpdateVersion installedVersion;
            TRAP_IGNORE( 
                installed = 
                    IAUpdateUtils::IsAppInstalledL( dependency->Uid(), 
                                                    installedVersion ) );    
            if ( installed && installedVersion > dependency->VersionRoof() )
                {
                IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeDetails::EmbededDegrades() end: ETrue");
                return ETrue;
                }   
            }
        }
        
    IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeDetails::EmbededDegrades() end: EFalse");
    
    return EFalse;
    }
Exemplo n.º 5
0
void
CSDReader::implementation (DOMElement* element)
throw(CSDReadException)
{
	DOMNodeList* nodeList;
	unsigned int len = 0;
	unsigned int i = 0;

	//
	// dependency
	//
	nodeList = element->getElementsByTagName(X("dependency"));
	len = nodeList->getLength();
    for (i = 0; i < len; ++i)
    {
        dependency((DOMElement*)(nodeList->item(i)));
    }

	//
	// descriptor
	//
	nodeList = element->getElementsByTagName(X("descriptor"));
	len = nodeList->getLength();
    if(len == 1)
    {
        ccd_file_ = descriptor((DOMElement*)(nodeList->item(0)));
    }
	else if(len > 1)
	{
		NORMAL_ERR( "CSDReader: multiple descriptors" );
	}

	//
	// code
	//
	nodeList = element->getElementsByTagName(X("code"));
	len = nodeList->getLength();
	if(len == 0)
	{
		NORMAL_ERR2( "CSDReader: missing code for ", data_->uuid );
		throw CSDReadException();
	}
    for (i = 0; i < len; ++i)
    {
        code((DOMElement*)(nodeList->item(i)));
    }

	//
	// os
	//
	nodeList = element->getElementsByTagName(X("os"));
	len = nodeList->getLength();
    for (i = 0; i < len; ++i)
    {
        os((DOMElement*)(nodeList->item(i)));
    }

	// more todo
}
Exemplo n.º 6
0
void sendDesc::extend(nmethod* nm, mapOop receiverMapOop,
                      CountStub *cs_from_pic) {
  char *addr;
  bool isPerform= isPerformLookupType(raw_lookupType());
  if (   PIC && !isPerform
      && (addr= jump_addr(), addr != lookupRoutine())) {
    // already has at least one nmethod linked to the send
    CacheStub* s= pic();
    # if GENERATE_DEBUGGING_AIDS
      if (CheckAssertions) {
        assert(cs_from_pic==NULL, "discarding countStub?");
        if (!s) {
          // turning monomorphic ic into PIC; PIC will carry dependencies
          assert(dependency()->notEmpty(), "shouldn't be empty");
          // check for duplicate nmethod & rcvr map
          CountStub *oldcs= countStub();
          nmethod *oldnm= oldcs ? oldcs->target() : nmethod::findNMethod(addr);
          assert(   oldnm != nm
                 || receiverMapOop != oldnm->key.receiverMapOop(),
                 "already linked to this nmethod, why rebind?? (maybe I-cache did not get flushed)");
        }
      }
    # endif
    s= s->extend(this, nm, receiverMapOop);
    assert(s, "should have a PIC now");
    assert(dependency()->next == dependency()->prev, "more than one link");
  } else {
    // first time we execute this send, or PICs disabled, or perform, or
    // rebinding after a PIC has been removed, or non-map related misses
    if (isPerform) NumberOfPerformMisses++;
    if (!PIC) {
      CacheStub *s= pic();
      // remove existing PIC
      if (s) s->deallocate();
    }
    rebind(nm, NULL, cs_from_pic);
  }
  MachineCache::flush_instruction_cache_for_debugging();
  if (VerifyZoneOften) verify();
}
Exemplo n.º 7
0
void sendDesc::print() {
  if (isPrimCall()) {
    PrimDesc *pd= getPrimDescOfFirstInstruction(jump_addr(), true);
    lprintf("primitive: %s\n", pd->name());
    return;
  } 
  printIndent();
  printLookupType(raw_lookupType());
  LookupType l= lookupType();
  if (isPerformLookupType(l)) {
    lprintf(": argc: %ld", arg_count());
  } else {
    lprintf(": selector: ");
    selector()->print_real_oop();
  }
  if (l & DelegateeStaticBit) {
    lprintf(": delegatee: ");
    delegatee()->print_real_oop();
  }
  Indent++;
  printIndent();
  lprintf("addr: %#lx", jump_addr());
  if (Memory->code->contains(jump_addr())) {
    lprintf(" (nmethod %#lx)", nmethod::findNMethod(jump_addr()));
  }
  lprintf("; mask: "); printMask(mask());
  lprintf("\n");
  printIndent();
  lprintf("dependency: ");
  dependency()->print();
  lprintf("\n");
  if (pic()) {
    printIndent();
    lprintf("PIC: p ((CacheStub*)%#lx)->print()\n", pic());
  }
  if (countStub()) {
    printIndent();
    lprintf("count stub: p ((CountStub*)%#lx)->print()\n",
            countStub());
  }
  Indent --;
}
Exemplo n.º 8
0
void ClassLoaderData::record_dependency(const Klass* k, TRAPS) {
  assert(k != NULL, "invariant");

  ClassLoaderData * const from_cld = this;
  ClassLoaderData * const to_cld = k->class_loader_data();

  // Dependency to the null class loader data doesn't need to be recorded
  // because the null class loader data never goes away.
  if (to_cld->is_the_null_class_loader_data()) {
    return;
  }

  oop to;
  if (to_cld->is_anonymous()) {
    // Anonymous class dependencies are through the mirror.
    to = k->java_mirror();
  } else {
    to = to_cld->class_loader();

    // If from_cld is anonymous, even if it's class_loader is a parent of 'to'
    // we still have to add it.  The class_loader won't keep from_cld alive.
    if (!from_cld->is_anonymous()) {
      // Check that this dependency isn't from the same or parent class_loader
      oop from = from_cld->class_loader();

      oop curr = from;
      while (curr != NULL) {
        if (curr == to) {
          return; // this class loader is in the parent list, no need to add it.
        }
        curr = java_lang_ClassLoader::parent(curr);
      }
    }
  }

  // It's a dependency we won't find through GC, add it. This is relatively rare
  // Must handle over GC point.
  Handle dependency(THREAD, to);
  from_cld->_dependencies.add(dependency, CHECK);
}
Exemplo n.º 9
0
int main(void)
{
#if !(defined(BOOST_MSVC) && BOOST_MSVC < 1700) // Don't bother with VS2010, its result_of can't cope.
    //[barrier_example
    // Assume that groups is 10,000 items long with item.first being randomly
    // between 1 and 500. This example is adapted from the barrier() unit test.
    //
    // What we're going to do is this: for each item in groups, schedule item.first
    // parallel ops and a barrier which completes only when the last of that
    // parallel group completes. Chain the next group to only execute after the
    // preceding group's barrier completes. Repeat until all groups have been executed.
    std::shared_ptr<boost::afio::async_file_io_dispatcher_base> dispatcher=
        boost::afio::make_async_file_io_dispatcher();
    std::vector<std::pair<size_t, int>> groups;
    boost::afio::atomic<size_t> callcount[10000];
    memset(&callcount, 0, sizeof(callcount));
    
    // This lambda is what each parallel op in each group will do: increment an atomic
    // for that group.
    auto inccount = [](boost::afio::atomic<size_t> *count){ (*count)++; };
    
    // This lambda is called after each barrier completes, and it checks that exactly
    // the right number of inccount lambdas were executed.
    auto verifybarrier = [](boost::afio::atomic<size_t> *count, size_t shouldbe)
    {
        if (*count != shouldbe)
            throw std::runtime_error("Count was not what it should have been!");
        return true;
    };
    
    // For each group, dispatch ops and a barrier for them
    boost::afio::async_io_op next;
    bool isfirst = true;
    for(auto &run : groups)
    {
        // Create a vector of run.first size of bound inccount lambdas
        // This will be the batch issued for this group
        std::vector<std::function<void()>> thisgroupcalls(run.first, std::bind(inccount, &callcount[run.second]));
        std::vector<boost::afio::async_io_op> thisgroupcallops;
        // If this is the first item, schedule without precondition
        if (isfirst)
        {
            thisgroupcallops = dispatcher->call(thisgroupcalls).second;
            isfirst = false;
        }
        else
        {
            // Create a vector of run.first size of preconditions exactly
            // matching the number in this batch. Note that the precondition
            // for all of these is the preceding verify op
            std::vector<boost::afio::async_io_op> dependency(run.first, next);
            thisgroupcallops = dispatcher->call(dependency, thisgroupcalls).second;
        }
        // barrier() is very easy: its number of output ops exactly matches its input
        // but none of the output will complete until the last of the input completes
        auto thisgroupbarriered = dispatcher->barrier(thisgroupcallops);
        // Schedule a call of the verify lambda once barrier completes. Here we choose
        // the first item of the barrier's return, but in truth any of them are good.
        auto verify = dispatcher->call(thisgroupbarriered.front(), std::function<bool()>(std::bind(verifybarrier, &callcount[run.second], run.first)));
        // Set the dependency for the next batch to be the just scheduled verify op
        next = verify.second;
    }
    // next was the last op scheduled, so waiting on it waits on everything
    when_all(next).wait();
    //]
#endif
}
Exemplo n.º 10
0
bool CSetting::Deserialize(const TiXmlNode *node, bool update /* = false */)
{
  // handle <visible> conditions
  if (!ISetting::Deserialize(node, update))
    return false;

  const TiXmlElement *element = node->ToElement();
  if (element == NULL)
    return false;

  // get the attributes label and help
  int tmp = -1;
  if (element->QueryIntAttribute(XML_ATTR_LABEL, &tmp) == TIXML_SUCCESS && tmp > 0)
    m_label = tmp;
  
  tmp = -1;
  if (element->QueryIntAttribute(XML_ATTR_HELP, &tmp) == TIXML_SUCCESS && tmp > 0)
    m_help = tmp;
  const char *parentSetting = element->Attribute("parent");
  if (parentSetting != NULL)
    m_parentSetting = parentSetting;

  // get the <level>
  int level = -1;
  if (XMLUtils::GetInt(node, XML_ELM_LEVEL, level))
    m_level = (SettingLevel)level;
    
  if (m_level < (int)SettingLevelBasic || m_level > (int)SettingLevelInternal)
    m_level = SettingLevelStandard;

  const TiXmlNode *dependencies = node->FirstChild(XML_ELM_DEPENDENCIES);
  if (dependencies != NULL)
  {
    const TiXmlNode *dependencyNode = dependencies->FirstChild(XML_ELM_DEPENDENCY);
    while (dependencyNode != NULL)
    {
      CSettingDependency dependency(m_settingsManager);
      if (dependency.Deserialize(dependencyNode))
        m_dependencies.push_back(dependency);
      else
        CLog::Log(LOGWARNING, "CSetting: error reading <dependency> tag of \"%s\"", m_id.c_str());

      dependencyNode = dependencyNode->NextSibling(XML_ELM_DEPENDENCY);
    }
  }

  const TiXmlElement *control = node->FirstChildElement(XML_ELM_CONTROL);
  if (control != NULL)
  {
    if (!m_control.Deserialize(control, update) ||
        m_control.GetType() == SettingControlTypeNone)
    {
      CLog::Log(LOGERROR, "CSetting: error reading <control> tag of \"%s\"", m_id.c_str());
      return false;
    }
  }

  const TiXmlNode *updates = node->FirstChild(XML_ELM_UPDATES);
  if (updates != NULL)
  {
    const TiXmlElement *updateElem = updates->FirstChildElement(XML_ELM_UPDATE);
    while (updateElem != NULL)
    {
      CSettingUpdate update;
      if (update.Deserialize(updateElem))
      {
        if (!m_updates.insert(update).second)
          CLog::Log(LOGWARNING, "CSetting: duplicate <update> definition for \"%s\"", m_id.c_str());
      }
      else
        CLog::Log(LOGWARNING, "CSetting: error reading <update> tag of \"%s\"", m_id.c_str());

      updateElem = updateElem->NextSiblingElement(XML_ELM_UPDATE);
    }
  }

  if ((m_control.GetType() == SettingControlTypeSpinner || m_control.GetType() == SettingControlTypeEdit) &&
        m_control.GetFormat() == SettingControlFormatNone)
  {
    CLog::Log(LOGERROR, "CSetting: invalid <control> tag of \"%s\"", m_id.c_str());
    return false;
  }
    
  return true;
}
Exemplo n.º 11
0
void
CSDReader::softpkg (DOMElement* element)
throw(CSDReadException)
{
	if ( !package_ ) abort();
	std::string element_name;
    DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = Qedo::transcode(child->getNodeName());

			//
			// title
			//
			if (element_name == "title")
			{
				title((DOMElement*)child);
			}

			//
			// pkgtype
			//
			else if (element_name == "pkgtype")
			{
				pkgtype((DOMElement*)child);
			}

			//
			// repository
			//
			else if (element_name == "repository")
			{
				// TODO
			}

			//
			// author
			//
			else if (element_name == "author")
			{
				author((DOMElement*)child);
			}

			//
			// description
			//
			else if (element_name == "description")
			{
				description((DOMElement*)child);
			}

			//
			// license
			//
			else if (element_name == "license")
			{
				license((DOMElement*)child);
			}

			//
			// idl
			//
			else if (element_name == "idl")
			{
				idl((DOMElement*)child);
			}

			//
			// propertyfile
			//
			else if (element_name == "propertyfile")
			{
				propertyfile((DOMElement*)child);
			}

			//
			// dependency
			//
			else if (element_name == "dependency")
			{
				dependency((DOMElement*)child);
			}

			//
			// extension
			//
			else if (element_name == "extension")
			{
				extension((DOMElement*)child);
			}
		}

		// get next child
		child = child->getNextSibling();
    }

	DOMNodeList* nodeList;
	DOMElement* elem;
	unsigned int len = 0;
	unsigned int i = 0;
	std::string uuid = data_->uuid;

    //
	// implementation
	//
	nodeList = element->getElementsByTagName(X("implementation"));
	len = nodeList->getLength();
	bool impl_found = false;
    for (i = 0; i < len; ++i)
    {
		elem = (DOMElement*)(nodeList->item(i));
		if (!XMLString::compareString(elem->getAttribute(X("id")), X(uuid.c_str())))
		{
			impl_found = true;
			break;
		}
    }
	if(impl_found)
	{
		implementation(elem);
	}
	else
	{
		NORMAL_ERR3( "CSDReader: implementation for ", uuid, " missing!" );
		throw CSDReadException();
	}

    //
	// corba component descriptor
	//
    if (ccd_file_.empty())
    {
		nodeList = element->getElementsByTagName(X("descriptor"));
		len = nodeList->getLength();
		if(len == 1)
		{
			ccd_file_ = descriptor((DOMElement*)(nodeList->item(0)));
		}
		else if(len > 1)
		{
			NORMAL_ERR( "CSDReader: multiple descriptor elements!" );
		}

		if (ccd_file_.empty())
        {
			NORMAL_ERR2( "CSDReader: missing component descriptor for ", uuid );
	        throw CSDReadException();
        }
    }
	//
	// parse the corba component descriptor file
    //
	CCDReader reader( path_ + ccd_file_, path_ );
	reader.readCCD( &(data_->component), package_ );
}
Exemplo n.º 12
0
void d8_upslope_area(const array2d<T> &flowdirs, array2d<U> &area){
  char_2d dependency;
  std::queue<grid_cell> sources;
  ProgressBar progress;

  diagnostic("\n###D8 Upslope Area\n");

  diagnostic_arg(
    "The sources queue will require at most approximately %ldMB of RAM.\n",
    flowdirs.width()*flowdirs.height()*((long)sizeof(grid_cell))/1024/1024
  );

  diagnostic("Resizing dependency matrix...");
  dependency.copyprops(flowdirs);
  diagnostic("succeeded.\n");

  diagnostic("Setting up the area matrix...");
  area.copyprops(flowdirs);
  area.init(0);
  area.no_data=d8_NO_DATA;
  diagnostic("succeeded.\n");

  diagnostic("%%Calculating dependency matrix & setting no_data cells...\n");
  progress.start( flowdirs.width()*flowdirs.height() );
  #pragma omp parallel for
  for(int x=0;x<flowdirs.width();x++){
    progress.update( x*flowdirs.height() );
    for(int y=0;y<flowdirs.height();y++){
      dependency(x,y)=0;
      if(flowdirs(x,y)==flowdirs.no_data){
        area(x,y)=area.no_data;
        continue;
      }
      for(int n=1;n<=8;n++)
        if(!flowdirs.in_grid(x+dx[n],y+dy[n]))
          continue;
        else if(flowdirs(x+dx[n],y+dy[n])==NO_FLOW)
          continue;
        else if(flowdirs(x+dx[n],y+dy[n])==flowdirs.no_data)
          continue;
        else if(n==inverse_flow[(int)flowdirs(x+dx[n],y+dy[n])])
          ++dependency(x,y);
    }
  }
  diagnostic_arg(SUCCEEDED_IN,progress.stop());

  diagnostic("%%Locating source cells...\n");
  progress.start( flowdirs.width()*flowdirs.height() );
  for(int x=0;x<flowdirs.width();x++){
    progress.update( x*flowdirs.height() );
    for(int y=0;y<flowdirs.height();y++)
      if(flowdirs(x,y)==flowdirs.no_data)
        continue;
      else if(dependency(x,y)==0)
        sources.push(grid_cell(x,y));
  }
  diagnostic_arg(SUCCEEDED_IN,progress.stop());

  diagnostic("%%Calculating up-slope areas...\n");
  progress.start(flowdirs.data_cells);
  long int ccount=0;
  while(sources.size()>0){
    grid_cell c=sources.front();
    sources.pop();

    ccount++;
    progress.update(ccount);

    area(c.x,c.y)+=1;

    if(flowdirs(c.x,c.y)==NO_FLOW)
      continue;

    int nx=c.x+dx[(int)flowdirs(c.x,c.y)];
    int ny=c.y+dy[(int)flowdirs(c.x,c.y)];
    if(flowdirs.in_grid(nx,ny) && area(nx,ny)!=area.no_data){
      area(nx,ny)+=area(c.x,c.y);
      if((--dependency(nx,ny))==0)
        sources.push(grid_cell(nx,ny));
    }
  }
  diagnostic_arg(SUCCEEDED_IN,progress.stop());
}
Exemplo n.º 13
0
void dinf_upslope_area_interval(const float_2d &flowdirs, grid_engine< boost::numeric::interval<T> > &area){
  char_2d dependency;
  std::queue<grid_cell> sources;
  ProgressBar progress;

  diagnostic_arg("The sources queue will require at most approximately %ldMB of RAM.\n",flowdirs.width()*flowdirs.height()*((long)sizeof(grid_cell))/1024/1024);

  diagnostic("Setting up the dependency matrix...");
  dependency.copyprops(flowdirs);
  dependency.init(0);
  diagnostic("succeeded.\n");

  diagnostic("Setting up the area matrix...");
  area.copyprops(flowdirs);
  area.init((float)0);
  area.no_data=dinf_NO_DATA;
  diagnostic("succeeded.\n");

  bool has_cells_without_flow_directions=false;
  diagnostic("%%Calculating dependency matrix & setting no_data cells...\n");
  progress.start( flowdirs.width()*flowdirs.height() );
  #pragma omp parallel for reduction(|:has_cells_without_flow_directions)
  for(int x=0;x<flowdirs.width();x++){
    progress.update( x*flowdirs.height() );
    for(int y=0;y<flowdirs.height();y++){
      if(flowdirs(x,y)==flowdirs.no_data){
        area(x,y)=area.no_data;
        dependency(x,y)=9;  //Note: This is an unnecessary safety precaution
        continue;
      }
      if(flowdirs(x,y)==NO_FLOW){
        has_cells_without_flow_directions=true;
        continue;
      }
      int n_high,n_low;
      int nhx,nhy,nlx,nly;
      where_do_i_flow(flowdirs(x,y),n_high,n_low);
      nhx=x+dinf_dx[n_high],nhy=y+dinf_dy[n_high];
      if(n_low!=-1){
        nlx=x+dinf_dx[n_low];
        nly=y+dinf_dy[n_low];
      }
      if( n_low!=-1 && flowdirs.in_grid(nlx,nly) && flowdirs(nlx,nly)!=flowdirs.no_data )
        dependency(nlx,nly)++;
      if( flowdirs.in_grid(nhx,nhy) && flowdirs(nhx,nhy)!=flowdirs.no_data )
        dependency(nhx,nhy)++;
    }
  }
  diagnostic_arg(SUCCEEDED_IN,progress.stop());
  if(has_cells_without_flow_directions)
    diagnostic("\033[91mNot all cells had defined flow directions! This implies that there will be digital dams!\033[39m\n");

  diagnostic("%%Locating source cells...\n");
  progress.start( flowdirs.width()*flowdirs.height() );
  for(int x=0;x<flowdirs.width();x++){
    progress.update( x*flowdirs.height() );
    for(int y=0;y<flowdirs.height();y++)
      if(flowdirs(x,y)==flowdirs.no_data)
        continue;
      else if(flowdirs(x,y)==NO_FLOW)
        continue;
      else if(dependency(x,y)==0)
        sources.push(grid_cell(x,y));
  }
  diagnostic_arg(SUCCEEDED_IN,progress.stop());

  diagnostic("%%Calculating up-slope areas...\n");
  progress.start( flowdirs.data_cells );
  long int ccount=0;
  while(sources.size()>0){
    grid_cell c=sources.front();
    sources.pop();

    ccount++;
    progress.update(ccount);

    if(flowdirs(c.x,c.y)==flowdirs.no_data)  //TODO: This line shouldn't be necessary since NoData's do not get added below
      continue;

    area(c.x,c.y)+=1;

    if(flowdirs(c.x,c.y)==NO_FLOW)
      continue;

    int n_high,n_low,nhx,nhy,nlx,nly;
    where_do_i_flow(flowdirs(c.x,c.y),n_high,n_low);
    nhx=c.x+dinf_dx[n_high],nhy=c.y+dinf_dy[n_high];

    float phigh,plow;
    area_proportion(flowdirs(c.x,c.y), n_high, n_low, phigh, plow);
    if(flowdirs.in_grid(nhx,nhy) && flowdirs(nhx,nhy)!=flowdirs.no_data)
      area(nhx,nhy)+=area(c.x,c.y)*(T)phigh;

    if(n_low!=-1){
      nlx=c.x+dinf_dx[n_low];
      nly=c.y+dinf_dy[n_low];
      if(flowdirs.in_grid(nlx,nly) && flowdirs(nlx,nly)!=flowdirs.no_data){
        area(nlx,nly)+=area(c.x,c.y)*(T)plow;
        if((--dependency(nlx,nly))==0)
          sources.push(grid_cell(nlx,nly));
      }
    }

    if( flowdirs.in_grid(nhx,nhy) && flowdirs(nhx,nhy)!=flowdirs.no_data && (--dependency(nhx,nhy))==0)
      sources.push(grid_cell(nhx,nhy));
  }
  diagnostic_arg(SUCCEEDED_IN,progress.stop());
}
Exemplo n.º 14
0
void Module::addDependency(const std::string& fname) {
    std::string dependency(fname);
    dependency.resize(dependency.size() - 2);
    dependencies.push_back(dependency);
}
Exemplo n.º 15
0
void sendDesc::link(CacheStub* s) {
  set_jump_addr(s->insts());
  assert(dependency()->isEmpty(), "not empty");
  dependency()->add(&s->cacheLink);
  MachineCache::flush_instruction_cache_for_debugging();
}
Exemplo n.º 16
0
// rebind the sendDesc to nm at addr, with cs_from_pic if non-NULL
void sendDesc::rebind(nmethod* nm, char* addr, CountStub *cs_from_pic) {
  if (VerifyZoneOften) {
    nm->linkedSends.verify_list_integrity();
    if (dependency()->next == NULL  &&  dependency()->prev == NULL)
      ; // not initted yet
    else
      verify();
  }
  if (addr == NULL) addr= nm->entryPointFor(this);
  assert(pic() == NULL, "shouldn't call");
  assert(nm->key.selector
         == static_or_dynamic_selector(nm->key.selector, nm->key.lookupType),
         "mismatched selector");
  nmethod* current= target();
  assert(   RecompilationInProgress
         || current != nm
         || nm->isYoung(),  // rebind to insert aging stub
         "why rebind?? (maybe I-cache did not get flushed)");

  if (nm->isDI() && countType() != NonCounting) {
    // turn off counting/comparing flag - cannot inline DI nmethods yet
    setCounting(NonCounting);
    assert(countType() == NonCounting, "oops");
  }
  CountStub *oldcs= countStub();
  assert(cs_from_pic == NULL || oldcs == NULL,
         "got count stub from pic and count stub from sendDesc");

  if (cs_from_pic) {
    assert(   nm->isYoung() && cs_from_pic->isAgingStub()
           || isCounting()  && cs_from_pic->isCountStub(),
              "count stub from pic doesn't match send desc");
    set_jump_addr(cs_from_pic->insts());
    dependency()->rebind(&cs_from_pic->sdLink);
    cs_from_pic->set_callee((int32)addr);
  } else if (UseAgingStubs && nm->isYoung()) {
    // need to insert an aging stub
    if (oldcs) {
      oldcs->deallocate();
    } else if (current) {
      dependency()->remove();
    }
    CountStub *newcs= new AgingStub(nm, addr, dependency());
    set_jump_addr(newcs->insts());
  } else if (UseAgingStubs && oldcs) {
    // change target of existing count stub
    oldcs->rebind(nm, addr);
  } else if (UseAgingStubs && isCounting()) {
    // create count stub
    if (current) dependency()->remove();        // unlink current target
    CountStub *newcs = 
      CountStub::new_CountStub(nm, addr, dependency(), countType()); 
    set_jump_addr(newcs->insts());
  } else {
    // rebind inline cache
    set_jump_addr(addr);
    dependency()->rebind(&nm->linkedSends);
  }
  if (VerifyZoneOften) verify();
  MachineCache::flush_instruction_cache_for_debugging();
}
Exemplo n.º 17
0
bool sendDesc::verify() {
  if (isPrimCall()) return true;
  LookupType l= lookupType();
  bool flag= checkLookupTypeAndEntryPoint();
  
  if (isPerformLookupType(l)) {
    if (arg_count() < 0 || arg_count() > 100) {
      error2("sendDesc %#lx arg count %ld is invalid", this, arg_count());
      flag = false;
    }
  } else {
    if (! oop(selector())->verify_oop()) {
      flag = false;
    } else if (! selector()->is_string()) {
      error1("sendDesc %#lx selector isn't a string", this);
      flag = false;
    }
    nmethod* nm = target();
    if (nm == NULL) {
      CountStub* cs = countStub();
      if (cs) nm = cs->target();
    }
    if (nm == NULL) {
      CacheStub* cs = pic();
      if (cs) {
        nm= cs->get_method(0);
        oop sel= nm->key.selector;
        for (fint i= 1; i < cs->arity(); ++i)
          if (cs->get_method(i)->key.selector != sel)
            error2("sendDesc %#lx: selector != PIC case %d selector",
                   this, i);
      }
    }
    if (nm && nm->key.selector != selector())
      error1("sendDesc %#lx: selector != target nmethod's selector", this);
  }
  if (l & DelegateeStaticBit) {
    if (! delegatee()->verify_oop()) {
      flag = false;
    } else if (baseLookupType(l) == DirectedResendLookupType &&
               ! delegatee()->is_string()) {
      error1("sendDesc %#lx delegatee isn't a string", this);
      flag = false;
    }
  }
  if (!dependency()->verify_list_integrity()) {
    lprintf("\tof sendDesc %#lx\n", this);
    flag = false;
  }
  if (pic()) {
    if (dependency()->next != dependency()->prev)
      error1("sendDesc %#lx: more than one elem in dependency chain", this);
    pic()->verify();
  } else {
    CountStub *cs= countStub();
    if (cs == NULL) {
      if (isCounting() && jump_addr() != lookupRoutine())
        error1("sendDesc %#lx: doesn't have countStub but is counting", this);
    } else {
      if (!isCounting() && !cs->isAgingStub())
        error1("sendDesc %#lx: has countStub but is not counting", this);
      if (dependency()->next != dependency()->prev)
        error1("sendDesc %#lx: more than one elem in dependency chain", this);
      countStub()->verify2(NULL);
    }
  }
  return flag;
}
Exemplo n.º 18
0
void sendDesc::unlink_nmethod() {
  dependency()->remove();
  reset_jump_addr();
  MachineCache::flush_instruction_cache_for_debugging();
}