Ejemplo n.º 1
0
static void
llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
{
   struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
   struct lp_fragment_shader *shader = fs;
   struct lp_fs_variant_list_item *li;

   assert(fs != llvmpipe->fs);
   (void) llvmpipe;

   /*
    * XXX: we need to flush the context until we have some sort of reference
    * counting in fragment shaders as they may still be binned
    * Flushing alone might not sufficient we need to wait on it too.
    */

   llvmpipe_finish(pipe, __FUNCTION__);

   li = first_elem(&shader->variants);
   while(!at_end(&shader->variants, li)) {
      struct lp_fs_variant_list_item *next = next_elem(li);
      remove_shader_variant(llvmpipe, li->base);
      li = next;
   }

   assert(shader->variants_cached == 0);
   FREE((void *) shader->base.tokens);
   FREE(shader);
}
Ejemplo n.º 2
0
// Step back n frames, skip any pseudo frames in between.
// This function is used in Class.forName, Class.newInstance, Method.Invoke,
// AccessController.doPrivileged.
//
// NOTE that in JDK 1.4 this has been exposed to Java as
// sun.reflect.Reflection.getCallerClass(), which can be inlined.
// Inlined versions must match this routine's logic.
// Native method prefixing logic does not need to match since
// the method names don't match and inlining will not occur.
// See, for example,
// Parse::inline_native_Reflection_getCallerClass in
// opto/library_call.cpp.
void vframeStreamCommon::security_get_caller_frame(int depth) {
  bool use_new_reflection = JDK_Version::is_gte_jdk14x_version() && UseNewReflection;

  while (!at_end()) {
    if (Universe::reflect_invoke_cache()->is_same_method(method())) {
      // This is Method.invoke() -- skip it
    } else if (use_new_reflection &&
              method()->method_holder()
                 ->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
      // This is an auxilary frame -- skip it
    } else if (method()->is_method_handle_intrinsic() ||
               method()->is_compiled_lambda_form()) {
      // This is an internal adapter frame for method handles -- skip it
    } else {
      // This is non-excluded frame, we need to count it against the depth
      if (depth-- <= 0) {
        // we have reached the desired depth, we are done
        break;
      }
    }
    if (method()->is_prefixed_native()) {
      skip_prefixed_method_and_wrappers();
    } else {
      next();
    }
  }
}
Ejemplo n.º 3
0
walker_base::state_t tree_node::next(const level level)
{
	if(at_end(level)) {
		return fail;
	}

	switch(level) {
		case self:
			if(widget_) {
				widget_ = nullptr;
				return invalid;
			} else {
				/* FALL DOWN */
			}
		case internal:
			assert(false);
			return fail;
		case child:
			if(itor_ == children_.end()) {
				/* FALL DOWN */
			} else {
				++itor_;
				return itor_ == children_.end() ? invalid : valid;
			}
	}

	assert(false);
	return fail;
}
Ejemplo n.º 4
0
lnk_old_ATTLC*
Liztiter_old_ATTLC::remove_next()
{
	if (at_end())
	    return NULL;

	lnk_old_ATTLC *doomed = pred->nxt;
	if (pred == pred->nxt) {    // this is only item
	    theLizt->t = 0;
	    register Liztiter_old_ATTLC* anIt;
	    for (anIt=&(theLizt->myit); anIt; anIt=anIt->nextIt) {
	        anIt->pred = 0;
	        anIt->index = 0;
	    }
	} else {
	    if (doomed == theLizt->t)    // deleting tail
	        theLizt->t = doomed->prv;
	    register Liztiter_old_ATTLC* anIt;
	    for (anIt=&(theLizt->myit); anIt; anIt=anIt->nextIt) {
	        if(anIt->pred == doomed) anIt->pred = doomed->prv;
	        if(anIt->index > index) anIt->index--;
	    }
	    pred->nxt = doomed->nxt;
	    doomed->nxt->prv = pred;
	}
	theLizt->sz--;
	return doomed;
}
Ejemplo n.º 5
0
void
RiscOperators::Cursor::init()
{
    skip_invalid();
    if (!at_end())
        ops_->before(idx_);
}
Ejemplo n.º 6
0
T*
Const_listiter<T>::peek_next() const
{
	if ( at_end() )
	 	return 0;
	return &(((lnnk_ATTLC<T>*)Liztiter_ATTLC::peek_next())->val);
}
Ejemplo n.º 7
0
BaseSemantics::SValuePtr
RiscOperators::Cursor::operator()(const BaseSemantics::SValuePtr &a_) const
{
    ASSERT_require(!at_end());
    SValuePtr a = SValue::promote(a_);
    return a->get_subvalue(idx_);
}
Ejemplo n.º 8
0
T
Const_listiter_old<T>::peek_next() const
{
	if ( at_end() )
		return T();
	return ((lnnk_old_ATTLC<T>*)Liztiter_old_ATTLC::peek_next())->val;
}
Ejemplo n.º 9
0
twalker_::tstate tgrid::next(const tlevel level)
{
	if(at_end(level)) {
		return fail;
	}

	switch(level) {
		case widget:
			if(widget_) {
				widget_ = NULL;
				return invalid;
			} else {
				 /* FALL DOWN */
			}
		case grid:
			assert(false);
			return fail;
		case child:
			if(itor_ == grid_.end()) {
				/* FALL DOWN */
			} else {
				++itor_;
				return itor_ == grid_.end() ? invalid : valid;
			}
	}

	assert(false);
	return fail;
}
Ejemplo n.º 10
0
/**
 * Update fragment state.  This is called just prior to drawing
 * something when some fragment-related state has changed.
 */
void 
llvmpipe_update_fs(struct llvmpipe_context *lp)
{
   struct lp_fragment_shader *shader = lp->fs;
   struct lp_fragment_shader_variant_key key;
   struct lp_fragment_shader_variant *variant = NULL;
   struct lp_fs_variant_list_item *li;

   make_variant_key(lp, shader, &key);

   li = first_elem(&shader->variants);
   while(!at_end(&shader->variants, li)) {
      if(memcmp(&li->base->key, &key, shader->variant_key_size) == 0) {
         variant = li->base;
         break;
      }
      li = next_elem(li);
   }

   if (variant) {
      move_to_head(&lp->fs_variants_list, &variant->list_item_global);
   }
   else {
      int64_t t0, t1;
      int64_t dt;
      unsigned i;
      if (lp->nr_fs_variants >= LP_MAX_SHADER_VARIANTS) {
         struct pipe_context *pipe = &lp->pipe;

         /*
          * XXX: we need to flush the context until we have some sort of reference
          * counting in fragment shaders as they may still be binned
          * Flushing alone might not be sufficient we need to wait on it too.
          */
         llvmpipe_finish(pipe, __FUNCTION__);

         for (i = 0; i < LP_MAX_SHADER_VARIANTS / 4; i++) {
            struct lp_fs_variant_list_item *item = last_elem(&lp->fs_variants_list);
            remove_shader_variant(lp, item->base);
         }
      }
      t0 = os_time_get();

      variant = generate_variant(lp, shader, &key);

      t1 = os_time_get();
      dt = t1 - t0;
      LP_COUNT_ADD(llvm_compile_time, dt);
      LP_COUNT_ADD(nr_llvm_compiles, 2);  /* emit vs. omit in/out test */

      if (variant) {
         insert_at_head(&shader->variants, &variant->list_item_local);
         insert_at_head(&lp->fs_variants_list, &variant->list_item_global);
         lp->nr_fs_variants++;
         shader->variants_cached++;
      }
   }

   lp_setup_set_fs_variant(lp->setup, variant);
}
Ejemplo n.º 11
0
lnk_old_ATTLC*
Liztiter_old_ATTLC::next()
{
	if (at_end()) return NULL;
	pred = pred->nxt;
	index++;
	return pred;
}
Ejemplo n.º 12
0
void vframeStream::skip_reflection_related_frames() {
  while (!at_end() &&
         (Universe::is_gte_jdk14x_version() && UseNewReflection &&
          (Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_method_accessor_klass()) ||
           Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_constructor_accessor_klass())))) {
    next();
  }
}
Ejemplo n.º 13
0
void InterpretedIC_Iterator::advance() {
  assert(!at_end(), "iterated over the end");
  _index++;
  if (! at_end()) {
    if (_pic != NULL) {
      // polymorphic inline cache
      int index = _index + 1; 	// array is 1-origin
      set_klass (_pic->obj_at(2 * index));
      set_method(_pic->obj_at(2 * index - 1));
    } else {
      // predicted send with non_empty inline cache
      assert(_index < 2, "illegal index");
      set_klass(_ic->second_word());
      set_method(_ic->first_word());
    }
  }
}
Ejemplo n.º 14
0
bool lexer::next(){
    
    if(at_end()){
        return false;
    }
    
    return scan(end, source_end, *this);
}
Ejemplo n.º 15
0
T*
Const_listiter<T>::next()
{
	if ( at_end() )
		return 0;
	lnnk_ATTLC<T>* ll = (lnnk_ATTLC<T>*)Liztiter_ATTLC::next();
	return &(ll->val);
}
Ejemplo n.º 16
0
int
Const_listiter<T>::next(T*& t)
{
	if ( at_end() )
		return 0;
	else
		return (t = &((lnnk_ATTLC<T>*)Liztiter_ATTLC::next())->val, 1);
}
Ejemplo n.º 17
0
void vframeStreamCommon::skip_reflection_related_frames() {
  while (!at_end() &&
         (JDK_Version::is_gte_jdk14x_version() && UseNewReflection &&
          (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
           method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
    next();
  }
}
Ejemplo n.º 18
0
int
Const_listiter_old<T>::peek_next(T*& t) const
{
	if ( at_end() )
		return 0;
	else
		return (t = &((lnnk_old_ATTLC<T>*)Liztiter_old_ATTLC::peek_next())->val, 1);
}
Ejemplo n.º 19
0
int
Listiter_old<T>::replace_next(const T& x)
{
	if ( at_end() )
		return 0;
	else
		return (((lnnk_old_ATTLC<T>*)Liztiter_old_ATTLC::peek_next())->val=x,1);
}
Ejemplo n.º 20
0
int
Const_listiter_old<T>::next(T& t)
{
	if ( at_end() )
		return 0;
	else
		return (t = ((lnnk_old_ATTLC<T>*)Liztiter_old_ATTLC::next())->val, 1);
}
Ejemplo n.º 21
0
void
RiscOperators::Cursor::next()
{
    ops_->after(idx_);
    ++idx_;
    skip_invalid();
    if (!at_end())
        ops_->before(idx_);
}
Ejemplo n.º 22
0
void vframeStream::skip_method_invoke_and_aux_frames() {
  while (!at_end() &&
         (method() == Universe::reflect_invoke_method()
          || (Universe::is_gte_jdk14x_version() && UseNewReflection &&
              Klass::cast(method()->method_holder())
              ->is_subclass_of(SystemDictionary::reflect_method_accessor_klass())))) {
    next();
  }
}
Ejemplo n.º 23
0
/* just returns if line is not completed yet */
int write_boundary(struct COOR *seed)
{
    struct COOR *point, *line_begin, *line_end;
    int dir, line_type, n, n1;

    point = seed;
    if ((dir = at_end(point))) {	/* already have one end of line */
	line_begin = point;
	line_end = find_end(point, dir, &line_type, &n);
	if (line_type == OPEN)
	    return (-1);	/* unfinished line */
	direction = dir;
    }
    else {			/* in middle of a line */
	line_end = find_end(point, FORWARD, &line_type, &n);
	if (line_type == OPEN)	/* line not finished */
	    return (-1);

	if (line_type == END) {	/* found one end at least *//* look for other one */
	    line_begin = find_end(point, BACKWARD, &line_type, &n1);
	    if (line_type == OPEN)	/* line not finished */
		return (-1);
	    if (line_type == LOOP) {	/* this should NEVER be the case */
		return (-1);
	    }
	    direction = at_end(line_begin);	/* found both ends now; total length */
	    n += n1;		/*   is sum of distances to each end */
	}
	else {
	    /* line_type = LOOP by default */
	    /* already have correct length */
	    line_begin = line_end;	/* end and beginning are the same */
	    direction = FORWARD;	/* direction is arbitrary */
	}
    }

    if (smooth_flag == SMOOTH)
	write_smooth_bnd(line_begin, line_end, n);
    else
	write_bnd(line_begin, line_end, n);

    return (0);
}
Ejemplo n.º 24
0
usize Buffer::read(void* data, usize bytes) {
	if(at_end()) {
		return 0;
	}
	usize max = std::min(bytes, remaining());
	std::copy_n(&_buffer[_read_cursor], max, reinterpret_cast<u8*>(data));

	_read_cursor += max;
	return max;
}
Ejemplo n.º 25
0
// Step back n frames, skip and pseudo frames in between.
// This function is used in Class.forName, Class.newInstance, Method.Invoke, 
// AccessController.doPrivileged.
//
// NOTE that in JDK 1.4 this has been exposed to Java as
// sun.reflect.Reflection.getCallerClass(), which can be inlined.
// Inlined versions must match this routine's logic. See, for example,
// Parse::inline_native_Reflection_getCallerClass in
// opto/library_call.cpp.
void vframeStream::security_get_caller_frame(int depth) {    
  while (depth-- > 0) {
    // skip Method.invoke() and auxiliary frames
    skip_method_invoke_and_aux_frames();
    if (at_end()) return;    
    // Skip real frame
    next();
  }

  // skip Method.invoke() and auxiliary frames
  skip_method_invoke_and_aux_frames();
}
Ejemplo n.º 26
0
 /// Advance to next sample
 void advance()
 {
     assert(!at_end());
     m_offset += sample_size();
     m_sample_index += 1;
     m_chunk_sample += 1;
     if (m_chunk_sample >= m_stsc->samples_for_chunk(m_chunk_index))
     {
         m_chunk_index += 1;
         m_chunk_sample = 0;
         m_offset = 0;
     }
 }
Ejemplo n.º 27
0
// Step back n frames, skip any pseudo frames in between.
// This function is used in Class.forName, Class.newInstance, Method.Invoke,
// AccessController.doPrivileged.
void vframeStreamCommon::security_get_caller_frame(int depth) {
  assert(depth >= 0, err_msg("invalid depth: %d", depth));
  for (int n = 0; !at_end(); security_next()) {
    if (!method()->is_ignored_by_security_stack_walk()) {
      if (n == depth) {
        // We have reached the desired depth; return.
        return;
      }
      n++;  // this is a non-skipped frame; count it against the depth
    }
  }
  // NOTE: At this point there were not enough frames on the stack
  // to walk to depth.  Callers of this method have to check for at_end.
}
Ejemplo n.º 28
0
  int write(const void* buffer, int length) noexcept
  {
    const char* data = (const char*) buffer;
    if (length > free_space()) {
      length = free_space();
      if (length == 0) return 0;
    }

    // check if we are going around the buffer ...
    int wrap = (end + length) - this->cap;

    if (wrap > 0) {
      memcpy(at_end() ,    data, length - wrap);
      memcpy(this->buffer, data + length - wrap, wrap);
    }
    else {
      memcpy(at_end(), data, length);
    }
    this->used += length;
    // make sure it wraps properly around
    this->end = (this->end + length) % capacity();
    return length;
  }
Ejemplo n.º 29
0
	explicit tbottom_up(twidget& root) : root_(root.create_walker()), stack_()
	{
		TST_GUI_I << "Constructor: ";
		while(!tvisit_child::at_end(*root_)) {
			stack_.push_back(root_);
			root_ = tvisit_child::get(*root_)->create_walker();
			TST_GUI_I << " Down widget '" << operator*().id() << "'.";
		}

		if(!at_end()) {
			TST_GUI_I << " Finished at '" << operator*().id() << "'.\n";
		} else {
			TST_GUI_I << " Finished at the end.\n";
		}
	}
Ejemplo n.º 30
0
int
Const_listiter_old<T>::find_next(const T& x)
{
	if ( at_end() || theLizt->length()==0 )
		return 0;

	lnnk_old_ATTLC<T>* iter = (lnnk_old_ATTLC<T>*) pred;
	register int i = index;
	do {
		iter = (lnnk_old_ATTLC<T>*) iter->nxt;
		if (iter->val==x) {
			index = i;
			pred = iter->prv;
			return 1;
		}
		i++;
	} while ( i < theLizt->length() );
	return 0;
}