Beispiel #1
0
	void push(const char* scope)
	{
		ticket_type last = top();
		ticket_type t = 0;
		if (last) {
			t = m_tracer->push(last, scope);
		} else {
			t = m_tracer->push(m_tracer->root(), scope);
		}
		set_top(t);
	}
// This version requires locking.
inline HeapWord* G1OffsetTableContigSpace::allocate_impl(size_t size,
                                                HeapWord* const end_value) {
  HeapWord* obj = top();
  if (pointer_delta(end_value, obj) >= size) {
    HeapWord* new_top = obj + size;
    set_top(new_top);
    assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
    return obj;
  } else {
    return NULL;
  }
}
Beispiel #3
0
bool PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) {
  assert(ParallelScavengeHeap::heap()->is_in(obj), "Object outside heap");

  if (contains(obj)) {
    HeapWord* object_end = obj + obj_size;
    assert(object_end == top(), "Not matching last allocation");

    set_top(obj);
    return true;
  }

  return false;
}
// This version requires locking.
inline HeapWord* ContiguousSpace::allocate_impl(size_t size) {
  assert(Heap_lock->owned_by_self() ||
         (SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread()),
         "not locked");
  HeapWord* obj = top();
  if (pointer_delta(end(), obj) >= size) {
    HeapWord* new_top = obj + size;
    set_top(new_top);
    assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
    return obj;
  } else {
    return NULL;
  }
}
Beispiel #5
0
css_error css__compose_top(const css_computed_style *parent,
		const css_computed_style *child,
		css_computed_style *result)
{
	css_fixed length = 0;
	css_unit unit = CSS_UNIT_PX;
	uint8_t type = get_top(child, &length, &unit);

	if (type == CSS_TOP_INHERIT) {
		type = get_top(parent, &length, &unit);
	}

	return set_top(result, type, length, unit);
}
// This version requires locking.
inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
						HeapWord* const end_value) {
assert(Heap_lock.owned_by_self()||
         (SafepointSynchronize::is_at_safepoint() &&
          Thread::current()->is_VM_thread()),
         "not locked");
  HeapWord* obj = top();
  if (pointer_delta(end_value, obj) >= size) {
    HeapWord* new_top = obj + size;
    set_top(new_top);
    return obj;
  } else {
    return NULL;
  }
}
Beispiel #7
0
ptr<pub3::expr_dict_t>
json_encoder_t::top_dict ()
{
  ptr<pub3::expr_dict_t> ret;
  ptr<pub3::expr_t> &back = m_obj_stack.back ();
  if (!back) {
    ret = pub3::expr_dict_t::alloc ();
    back = ret;
    set_top (ret);
  } else {
    ret = back->to_dict ();
    assert (ret);
  }
  return ret;
}
bool PSPromotionLAB::unallocate_object(oop obj) {
  assert(Universe::heap()->is_in(obj), "Object outside heap");
  
  if (contains(obj)) {
    HeapWord* object_end = (HeapWord*)obj + obj->size();
    assert(object_end <= top(), "Object crosses promotion LAB boundary");

    if (object_end == top()) {
      set_top((HeapWord*)obj);
      return true;
    }
  }

  return false;
}
// Fills the current tlab with a dummy filler array to create
// an illusion of a contiguous Eden and optionally retires the tlab.
// Waste accounting should be done in caller as appropriate; see,
// for example, clear_before_allocation().
void ThreadLocalAllocBuffer::make_parsable(bool retire) {
  if (end() != NULL) {
    invariants();
    CollectedHeap::fill_with_object(top(), hard_end());

    if (retire || ZeroTLAB) {  // "Reset" the TLAB
      set_start(NULL);
      set_top(NULL);
      set_pf_top(NULL);
      set_end(NULL);
    }
  }
  assert(!(retire || ZeroTLAB)  ||
         (start() == NULL && end() == NULL && top() == NULL),
         "TLAB must be reset");
}
void HeapRegion::clear_humongous() {
  assert(isHumongous(), "pre-condition");

  if (startsHumongous()) {
    assert(top() <= end(), "pre-condition");
    set_end(_orig_end);
    if (top() > end()) {
      // at least one "continues humongous" region after it
      set_top(end());
    }
  } else {
    // continues humongous
    assert(end() == _orig_end, "sanity");
  }

  assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
  _humongous_start_region = NULL;
}
Beispiel #11
0
// This version requires locking.
inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
                                                HeapWord* const end_value) {
  // In G1 there are places where a GC worker can allocates into a
  // region using this serial allocation code without being prone to a
  // race with other GC workers (we ensure that no other GC worker can
  // access the same region at the same time). So the assert below is
  // too strong in the case of G1.
  assert(Heap_lock->owned_by_self() ||
         (SafepointSynchronize::is_at_safepoint() &&
                               (Thread::current()->is_VM_thread() || UseG1GC)),
         "not locked");
  HeapWord* obj = top();
  if (pointer_delta(end_value, obj) >= size) {
    HeapWord* new_top = obj + size;
    set_top(new_top);
    assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
    return obj;
  } else {
    return NULL;
  }
}
        IntrusiveAllocator(void* begin, void* end) :
            EmbeddedAllocator{begin, end, sizeof(void*)}
        {
            /*
             * Pool layout:
             *
             *    metadata         storage
             *  <---------> <------------------>
             * +-----+-----+--------------------+
             * | end | top |         ...        |
             * +-----+-----+--------------------+
             *             ^            ^       ^
             *             |            |       |
             *           begin         top    end
             *
             *             <------------>
             *              storage used
             *
             */

            set_top(EmbeddedAllocator::begin());
        }
Beispiel #13
0
        void* allocate(std::size_t size, std::size_t alignment, std::size_t offset = 0)
        {
			assert(offset == 0 && "Cannot do offsetting with this allocator, it stores metadata before user block-address");

            offset = sizeof(offset_t);

            char* user_ptr = detail::aligned_ptr(top() + offset, alignment);
            char* block_end = user_ptr + size;

            if (block_end <= end())
            {
                // Store padding length between current top and returned (user) ptr 
                detail::write_before(user_ptr, static_cast<offset_t>(user_ptr - top()));

                set_top(block_end);

                return user_ptr;
            }
            else
            {
                return nullptr;
            }
        }
/**
 * 从当前线程的本地分配缓冲区中分配指定大小的内存块
 */
inline HeapWord* ThreadLocalAllocBuffer::allocate(size_t size) {
  invariants();

  HeapWord* obj = top();
  if (pointer_delta(end(), obj) >= size) {	//缓冲区的空闲内存足够本次分配
    // successful thread-local allocation
#ifdef ASSERT
    // Skip mangling the space corresponding to the object header to
    // ensure that the returned space is not considered parsable by
    // any concurrent GC thread.
    size_t hdr_size = oopDesc::header_size();
    Copy::fill_to_words(obj + hdr_size, size - hdr_size, badHeapWordVal);
#endif // ASSERT

    //重置缓冲区分配内存的开始位置
    set_top(obj + size);

    invariants();
    return obj;
  }

  return NULL;
}
Beispiel #15
0
MirWaitHandle* MirSurface::modify(MirSurfaceSpec const& spec)
{
    mp::SurfaceModifications mods;

    {
        std::unique_lock<decltype(mutex)> lock(mutex);
        mods.mutable_surface_id()->set_value(surface->id().value());
    }

    auto const surface_specification = mods.mutable_surface_specification();

    #define COPY_IF_SET(field)\
        if (spec.field.is_set())\
        surface_specification->set_##field(spec.field.value())

    COPY_IF_SET(width);
    COPY_IF_SET(height);
    COPY_IF_SET(pixel_format);
    COPY_IF_SET(buffer_usage);
    // name is a special case (below)
    COPY_IF_SET(output_id);
    COPY_IF_SET(type);
    COPY_IF_SET(state);
    // preferred_orientation is a special case (below)
    // parent_id is a special case (below)
    // aux_rect is a special case (below)
    COPY_IF_SET(edge_attachment);
    COPY_IF_SET(min_width);
    COPY_IF_SET(min_height);
    COPY_IF_SET(max_width);
    COPY_IF_SET(max_height);
    COPY_IF_SET(width_inc);
    COPY_IF_SET(height_inc);
    // min_aspect is a special case (below)
    // max_aspect is a special case (below)
    #undef COPY_IF_SET

    if (spec.surface_name.is_set())
        surface_specification->set_name(spec.surface_name.value());

    if (spec.pref_orientation.is_set())
        surface_specification->set_preferred_orientation(spec.pref_orientation.value());

    if (spec.parent.is_set() && spec.parent.value())
        surface_specification->set_parent_id(spec.parent.value()->id());

    if (spec.parent_id)
    {
        auto id = surface_specification->mutable_parent_persistent_id();
        id->set_value(spec.parent_id->as_string());
    }

    if (spec.aux_rect.is_set())
    {
        auto const rect = surface_specification->mutable_aux_rect();
        auto const& value = spec.aux_rect.value();
        rect->set_left(value.left);
        rect->set_top(value.top);
        rect->set_width(value.width);
        rect->set_height(value.height);
    }

    if (spec.min_aspect.is_set())
    {
        auto const aspect = surface_specification->mutable_min_aspect();
        aspect->set_width(spec.min_aspect.value().width);
        aspect->set_height(spec.min_aspect.value().height);
    }

    if (spec.max_aspect.is_set())
    {
        auto const aspect = surface_specification->mutable_max_aspect();
        aspect->set_width(spec.max_aspect.value().width);
        aspect->set_height(spec.max_aspect.value().height);
    }

    if (spec.streams.is_set())
    {
        auto_resize_stream = false;
        for(auto const& stream : spec.streams.value())
        {
            auto const new_stream = surface_specification->add_stream();
            new_stream->set_displacement_x(stream.displacement_x);
            new_stream->set_displacement_y(stream.displacement_y);
            new_stream->mutable_id()->set_value(
                reinterpret_cast<mcl::ClientBufferStream*>(stream.stream)->rpc_id().as_value());
        }
    }

    if (spec.input_shape.is_set())
    {
        for (auto const& rect : spec.input_shape.value())
        {
            auto const new_shape = surface_specification->add_input_shape();
            new_shape->set_left(rect.left);
            new_shape->set_top(rect.top);
            new_shape->set_width(rect.width);
            new_shape->set_height(rect.height);
        }
    }

    modify_wait_handle.expect_result();
    server->modify_surface(&mods, modify_result.get(),
              google::protobuf::NewCallback(this, &MirSurface::on_modified));

    return &modify_wait_handle;
}
Beispiel #16
0
		/// \brief Set the top right corner
		constexpr void set_top_right(point< position_type > const& topRight){
			set_top(topRight.x);
			set_right(topRight.y);
		}
Beispiel #17
0
css_error css__set_top_from_hint(const css_hint *hint,
		css_computed_style *style)
{
	return set_top(style, hint->status,
			hint->data.length.value, hint->data.length.unit);
}
 void decommit(std::size_t bytes) 
 {
     set_top(top() - bytes);
 }
 void commit(std::size_t bytes) 
 {
     set_top(top() + bytes);
 }
Beispiel #20
0
bool
json_encoder_t::rpc_traverse (u_int64_t &obj)
{
  set_top (pub3::expr_uint_t::alloc (obj));
  return true;
}
void G1OffsetTableContigSpace::clear(bool mangle_space) {
  set_top(bottom());
  _scan_top = bottom();
  CompactibleSpace::clear(mangle_space);
  reset_bot();
}
Beispiel #22
0
static void stack_push(struct except_stacknode *node)
{
    node->except_down = get_top();
    set_top(node);
}
		TITANIUM_PROPERTY_SETTER(Animation, top)
		{
			TITANIUM_ASSERT(argument.IsNumber());
			set_top(static_cast<double>(argument));
			return true;
		}
Beispiel #24
0
bool
json_encoder_t::rpc_encode (str s)
{
  set_top (pub3::expr_str_t::alloc (s));
  return true;
}
Beispiel #25
0
bool
json_encoder_t::rpc_traverse_null()
{
  set_top (pub3::expr_null_t::alloc ());
  return true;
}
Beispiel #26
0
void ContiguousSpace::clear(bool mangle_space) {
  set_top(bottom());
  set_saved_mark();
  CompactibleSpace::clear(mangle_space);
}
Beispiel #27
0
css_error css__initial_top(css_select_state *state)
{
	return set_top(state->computed, CSS_TOP_AUTO, 0, CSS_UNIT_PX);
}
int main()
{
	create_connect();
	init_servo();


	//light_it_up(LIGHT_PORT);
	lightstart(LIGHT_PORT,120.0);

	create_full();
	create_drive_segment(HIGH_SPEED, -150);
	start_process(set_top);
	create_drive_arc(HIGH_SPEED, -200, 155);
	create_drive_segment(HIGH_SPEED, -365);
	create_drive_arc(HIGH_SPEED, 90, -64);
	create_drive_segment(HIGH_SPEED, -85);
	create_cease();
	set_top();
	align_twall();
	grab_top_de();
	create_spin_angle(400,-165);
	create_drive_segment(HIGH_SPEED, -320);
	//align_wall();
	create_stop();
	create_sync();
	dump_kelp_de();
	create_drive_segment(HIGH_SPEED,30);//go away from starting box
	create_spin_angle(HIGH_SPEED, -78);//turn to gate part 1
	create_drive_segment(HIGH_SPEED, 938);//go to gate
	create_drive_arc(HIGH_SPEED,185,84);//arc to gate
	//create_drive_time(HIGH_SPEED,1800);//go through the gate
	/*
	create_drive_segment(HIGH_SPEED,1470);
	create_drive_segment(HIGH_SPEED,-100);
	create_spin_angle(HIGH_SPEED,78);
	*/
	create_cease();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(2000);
	create_stop();
	create_arc(400,400);//arc to the opponent's mpa
	msleep(7000L);
	create_stop();//pause to keep the creat
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	create_drive_straight(-HIGH_SPEED);//go onto oppponent's side of board
	msleep(500);
	create_stop();
	/*
	create_drive_segment(500,-500);//go past the IC
	create_drive_arc(320,-250,25);//arc to
	create_drive_arc(320,250,-8);
	*/
	//create_drive_segment(HIGH_SPEED,-750);
	//create_drive_arc(HIGH_SPEED,100,84);
	//create_drive_segment(HIGH_SPEED,1300);
}
Beispiel #29
0
struct except_stacknode *except_pop(void)
{
    struct except_stacknode *top = get_top();
    set_top(top->except_down);
    return top;
}
Beispiel #30
0
Datei: rect.cpp Projekt: zxiy/gml
	rect& rect::set_pos(int x, int y)
	{
		set_left(x);
		set_top(y);
		return *this;
	}