Пример #1
0
static void
msprinter_mark_device (struct device *d)
{
  mark_object (DEVICE_MSPRINTER_FONTLIST (d));
  mark_object (DEVICE_MSPRINTER_DEVMODE (d));
  mark_object (DEVICE_MSPRINTER_NAME (d));
}
Пример #2
0
static int mark_root_table(lua_State* L, lua_State* dL, int type) {
	int len = 0;
	
	lua_pushnil(L);
	while (lua_next(L, -2) != 0) {
		++len;
		if (LUA_TTABLE == lua_type(L, -1)) {
			lua_pushvalue(L, -2);
			
			make_root(dL, lua_topointer(L, -2), lua_tostring(L, -1), type, NULL, 1);
			lua_pop(L, 1);
			mark_table(L, dL);
			lua_pop(dL, 1);
		} else {
		    make_root(dL, lua_topointer(L, -1), "FUNCTION", type, NULL, 0);
			mark_object(L, dL);
			lua_pop(dL, 1);
		}
		lua_pop(L, 1);
		
		make_root(dL, lua_topointer(L, -1), "[KEY]", type, NULL, LUA_TTABLE == lua_type(L, -1));
		mark_object(L, dL);
		lua_pop(dL, 1);
	}
	
	return len;
}
Пример #3
0
static inline void
_ase_metric_mark(ase_metric_t n)
{
	if (n == NULL)
		return;

	mark_object(n->ldist);
	mark_object(n->colour);
	return;
}
Пример #4
0
static Lisp_Object
mark_case_table (Lisp_Object obj)
{
  Lisp_Case_Table *ct = XCASE_TABLE (obj);

  mark_object (CASE_TABLE_DOWNCASE (ct));
  mark_object (CASE_TABLE_UPCASE (ct));
  mark_object (CASE_TABLE_CANON (ct));
  mark_object (CASE_TABLE_EQV (ct));
  return Qnil;
}
Пример #5
0
static void mark_range_object(CLObject object, unsigned char* mark_flg)
{
    CLObject object2;

    object2 = CLRANGE(object)->mHead;

    mark_object(object2, mark_flg);

    object2 = CLRANGE(object)->mTail;

    mark_object(object2, mark_flg);
}
Пример #6
0
static void
mark_thread(lua_State *L, lua_State *dL, const void * parent, const char *desc) {
	const void * t = readobject(L, dL, parent, desc);
	if (t == NULL)
		return;
	int level = 0;
	lua_State *cL = lua_tothread(L,-1);
	if (cL == L) {
		level = 1;
	} else {
		// mark stack
		int top = lua_gettop(cL);
		luaL_checkstack(cL, 1, NULL);
		int i;
		char tmp[16];
		for (i=0;i<top;i++) {
			lua_pushvalue(cL, i+1);
			sprintf(tmp, "[%d]", i+1);
			mark_object(cL, dL, cL, tmp);
		}
	}
	lua_Debug ar;
	luaL_Buffer b;
	luaL_buffinit(dL, &b);
	while (lua_getstack(cL, level, &ar)) {
		char tmp[128];
		lua_getinfo(cL, "Sl", &ar);
		luaL_addstring(&b, ar.short_src);
		if (ar.currentline >=0) {
			char tmp[16];
			sprintf(tmp,":%d ",ar.currentline);
			luaL_addstring(&b, tmp);
		}

		int i,j;
		for (j=1;j>-1;j-=2) {
			for (i=j;;i+=j) {
				const char * name = lua_getlocal(cL, &ar, i);
				if (name == NULL)
					break;
				snprintf(tmp, sizeof(tmp), "%s : %s:%d",name,ar.short_src,ar.currentline);
				mark_object(cL, dL, t, tmp);
			}
		}

		++level;
	}
	luaL_addstring(&b, "thread: ");
	luaL_pushresult(&b);
	lua_rawsetp(dL, SOURCE, t);
	lua_pop(L,1);
}
Пример #7
0
static int mark_widget_value_mapper(widget_value * val, void *closure)
{
	Lisp_Object markee;
	if (val->call_data) {
		VOID_TO_LISP(markee, val->call_data);
		mark_object(markee);
	}

	if (val->accel) {
		VOID_TO_LISP(markee, val->accel);
		mark_object(markee);
	}
	return 0;
}
Пример #8
0
void ship_select::OnOK()
{
	int i;
	object *ptr;

	unmark_all();
	update_status();
	ptr = GET_FIRST(&obj_used_list);
	while (ptr != END_OF_LIST(&obj_used_list))
	{
		if (ptr->flags & OF_TEMP_MARKED)
			mark_object(OBJ_INDEX(ptr));

		ptr = GET_NEXT(ptr);
	}

	if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) {
		Assert(Briefing_dialog);
		Briefing_dialog->icon_select(Objects[cur_object_index].instance);

	} else {
		if (Briefing_dialog)
			Briefing_dialog->icon_select(-1);
	}

	filter_ships = m_filter_ships;
	filter_starts = m_filter_starts;
	filter_waypoints = m_filter_waypoints;

	for (i = 0; i < MAX_IFFS; i++)
		filter_iff[i] = m_filter_iff[i];

	CDialog::OnOK();
}
Пример #9
0
void ship_select::OnOK()
{
	object *ptr;

	unmark_all();
	update_status();
	ptr = GET_FIRST(&obj_used_list);
	while (ptr != END_OF_LIST(&obj_used_list))
	{
		if (ptr->flags & OF_TEMP_MARKED)
			mark_object(OBJ_INDEX(ptr));

		ptr = GET_NEXT(ptr);
	}

	if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) {
		Assert(Briefing_dialog);
		Briefing_dialog->icon_select(Objects[cur_object_index].instance);

	} else {
		if (Briefing_dialog)
			Briefing_dialog->icon_select(-1);
	}

	filter_ships = m_filter_ships;
	filter_starts = m_filter_starts;
	filter_waypoints = m_filter_waypoints;
	filter_friendly = m_filter_friendly;
	filter_hostile = m_filter_hostile;
	filter_neutral = m_filter_neutral;
	filter_unknown = m_filter_unknown;
	CDialog::OnOK();
}
Пример #10
0
static void mark_function(lua_State *L, lua_State *dL) {
	const void *p = lua_topointer(L, -1);
	int i;
	lua_Debug ar;
	char used_in[128];
	const char *name;
	
	
	if (!is_marked(dL, p)) {
		marked(dL, p, 0); //已经在table里头算了
		
		lua_pushvalue(L, -1);
		lua_getinfo(L, ">S", &ar);
		snprintf(used_in, sizeof(used_in) - 1, "%s:%d~%d", ar.short_src, ar.linedefined, ar.lastlinedefined);
		used_in[sizeof(used_in) - 1] = 0;
		
		for (i=1;;i++) {
			name = lua_getupvalue(L,-1,i);
			if (name == NULL)
				break;
			p = lua_topointer(L, -1);
			
			if (*name != '\0' && LUA_TTABLE == lua_type(L, -1)) {
				make_root(dL, p, name, RT_UPVALUE, used_in, 1);
				lua_insert(dL, MARKED_TABLE);
				mark_object(L, dL);
				lua_remove(dL, MARKED_TABLE);
			} else if (LUA_TFUNCTION == lua_type(L, -1)) {
				mark_function(L, dL);
			}
			lua_pop(L, 1);
		}
	}
}
Пример #11
0
static void
mark_function(lua_State *L, lua_State *dL, const void * parent, const char *desc) {
    int i;
    const void * t = readobject(L, dL, parent, desc);
    if (t == NULL)
        return;

    mark_function_env(L,dL,t);
    for (i=1;; i++) {
        const char *name = lua_getupvalue(L,-1,i);
        if (name == NULL)
            break;
        mark_object(L, dL, t, name[0] ? name : "[upvalue]");
    }
    if (lua_iscfunction(L,-1)) {
        if (i==1) {
            // light c function
            lua_pushnil(dL);
            lua_rawsetp(dL, FUNCTION, t);
        }
        lua_pop(L,1);
    } else {
        lua_Debug ar;
        luaL_Buffer b;
        char tmp[16];

        lua_getinfo(L, ">S", &ar);
        luaL_buffinit(dL, &b);
        luaL_addstring(&b, ar.short_src);
        sprintf(tmp,":%d",ar.linedefined);
        luaL_addstring(&b, tmp);
        luaL_pushresult(&b);
        lua_rawsetp(dL, SOURCE, t);
    }
}
Пример #12
0
static void mark_object_recursive_skipping_klasses(oop obj) {
  mark_object(obj);
  if (obj != NULL) {
    MarkObjectsSkippingKlassesOopClosure mark_all;
    obj->oop_iterate(&mark_all);
  }
}
Пример #13
0
void
EditorInputCenter::grab_object() {
  if (hovered_object) {
    if (!hovered_object->is_valid()) {
      hovered_object = NULL;
      return;
    }

    dragged_object = hovered_object;
    auto pm = dynamic_cast<PointMarker*>(hovered_object);
    obj_mouse_desync = sector_pos - hovered_object->get_pos();
    // marker testing
    if (!pm) {
      mark_object();
    }
    last_node_marker = dynamic_cast<NodeMarker*>(pm);
    return;
  }
  dragged_object = NULL;
  if (edited_path && Editor::current()->tileselect.object == "#node") {
    if (edited_path->is_valid()) {
      return;
    }
  }
  delete_markers();
}
Пример #14
0
 void do_oop(oop* pobj) {
   oop obj = *pobj;
   if (obj != NULL &&
       !obj->is_klass()) {
     mark_object(obj);
   }
 }
Пример #15
0
  void do_object(oop obj) {

    // Character arrays referenced by String objects are read-only.

    if (java_lang_String::is_instance(obj)) {
      mark_object(java_lang_String::value(obj));
    }
  }
Пример #16
0
static inline void
_ase_cartesian_mark(ase_cartesian_t n)
{
	int i;

	if (n == NULL)
		return;

	for (i = 0; i < n->dimension; i++)
		mark_object(n->objects[i]);

	mark_object(n->lebesgue_measure);
	mark_object(n->rational_measure);
	mark_object(n->colour);
	mark_object(n->interior_type);
	return;
}
Пример #17
0
  void GarbageCollector::saw_variable_scope(CallFrame* call_frame,
      StackVariables* scope)
  {
    scope->self_ = mark_object(scope->self());
    scope->block_ = mark_object(scope->block());
    scope->module_ = (Module*)mark_object(scope->module());

    int locals = call_frame->cm->backend_method()->number_of_locals;
    for(int i = 0; i < locals; i++) {
      Object* local = scope->get_local(i);
      if(local->reference_p()) {
        scope->set_local(i, mark_object(local));
      }
    }

    if(scope->last_match_ && scope->last_match_->reference_p()) {
      scope->last_match_ = mark_object(scope->last_match_);
    }

    VariableScope* parent = scope->parent();
    if(parent) {
      scope->parent_ = (VariableScope*)mark_object(parent);
    }

    VariableScope* heap = scope->on_heap();
    if(heap) {
      scope->on_heap_ = (VariableScope*)mark_object(heap);
    }
  }
Пример #18
0
void MarkSweep::mark_and_follow(oop* p) {
  assert(Universe::heap()->is_in_reserved(p),
	 "we should only be traversing objects here");
  oop m = *p;
  if (m && !m->mark()->is_marked()) {
    mark_object(m);
    m->follow_contents();  // Follow contents of the marked object
  }
}
Пример #19
0
static void mark_bytes_object(CLObject object, unsigned char* mark_flg)
{
    int i;
    CLObject obj2;

    obj2 = CLBYTES(object)->mData;

    mark_object(obj2, mark_flg);
}
Пример #20
0
static Lisp_Object
sound_oss_mark(ad_device_data *devdata)
{
	sound_oss_data_t *sod = devdata;

	mark_object(sod->device);

	return Qnil;
}
Пример #21
0
static void mark_table(lua_State *L, lua_State *dL) {
	const void *p = lua_topointer(L, -1);
	int len = 0;
	
	if (!is_marked(dL, p)) {
		marked(dL, p, 0);

		lua_pushnil(L);
		while (lua_next(L, -2) != 0) {
			++len;
			mark_object(L, dL);
			lua_pop(L, 1);
			mark_object(L, dL);
		}
		
		marked(dL, p, len);
	}
}
Пример #22
0
static void
mark_function_env(lua_State *L, lua_State *dL, const void * t) {
    lua_getfenv(L,-1);
    if (lua_istable(L,-1)) {
        mark_object(L, dL, t, "[environment]");
    } else {
        lua_pop(L,1);
    }
}
Пример #23
0
static void
mark_table(lua_State *L, lua_State *dL, const void * parent, const char * desc) {
	const void * t = readobject(L, dL, parent, desc);
	if (t == NULL)
		return;

	bool weakk = false;
	bool weakv = false;
	if (lua_getmetatable(L, -1)) {
		lua_pushliteral(L, "__mode");
		lua_rawget(L, -2);
		if (lua_isstring(L,-1)) {
			const char *mode = lua_tostring(L, -1);
			if (strchr(mode, 'k')) {
				weakk = true;
			}
			if (strchr(mode, 'v')) {
				weakv = true;
			}
		}
		lua_pop(L,1);

        luaL_checkstack(L, LUA_MINSTACK, NULL);
		mark_table(L, dL, t, "[metatable]");
	}

	lua_pushnil(L);
	while (lua_next(L, -2) != 0) {
		if (weakv) {
			lua_pop(L,1);
		} else {
			char temp[32];
			const char * desc = keystring(L, -2, temp);
			mark_object(L, dL, t , desc);
		}
		if (!weakk) {
			lua_pushvalue(L,-1);
			mark_object(L, dL, t , "[key]");
		}
	}

	lua_pop(L,1);
}
Пример #24
0
  void do_object(oop obj) {

    // Mark all constMethod objects.

    if (obj->is_constMethod()) {
      mark_object(obj);
      mark_object(constMethodOop(obj)->stackmap_data());
      // Exception tables are needed by ci code during compilation.
      mark_object(constMethodOop(obj)->exception_table());
    }

    // Mark objects referenced by klass objects which are read-only.

    else if (obj->is_klass()) {
      Klass* k = Klass::cast((klassOop)obj);
      mark_object(k->secondary_supers());

      // The METHODS() OBJARRAYS CANNOT BE MADE READ-ONLY, even though
      // it is never modified. Otherwise, they will be pre-marked; the
      // GC marking phase will skip them; and by skipping them will fail
      // to mark the methods objects referenced by the array.

      if (obj->blueprint()->oop_is_instanceKlass()) {
        instanceKlass* ik = instanceKlass::cast((klassOop)obj);
        mark_object(ik->method_ordering());
        mark_object(ik->local_interfaces());
        mark_object(ik->transitive_interfaces());
        mark_object(ik->fields());

        mark_object(ik->class_annotations());

        mark_object_recursive_skipping_klasses(ik->fields_annotations());
        mark_object_recursive_skipping_klasses(ik->methods_annotations());
        mark_object_recursive_skipping_klasses(ik->methods_parameter_annotations());
        mark_object_recursive_skipping_klasses(ik->methods_default_annotations());

        typeArrayOop inner_classes = ik->inner_classes();
        if (inner_classes != NULL) {
          mark_object(inner_classes);
        }
      }
    }
  }
Пример #25
0
void mark_wing(int wing)
{
	int i;

	unmark_all();
	Assert(Wings[wing].special_ship >= 0 && Wings[wing].special_ship < Wings[wing].wave_count);
	set_cur_object_index(wing_objects[wing][Wings[wing].special_ship]);
	for (i=0; i<Wings[wing].wave_count; i++)
		mark_object(wing_objects[wing][i]);
}
Пример #26
0
template <class T> inline void MarkSweep::mark_and_push(T* p) {
//  assert(Universe::heap()->is_in_reserved(p), "should be in object space");
  T heap_oop = oopDesc::load_heap_oop(p);
  if (!oopDesc::is_null(heap_oop)) {
    oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
    if (!obj->mark()->is_marked()) {
      mark_object(obj);
      _marking_stack.push(obj);
    }
  }
}
Пример #27
0
static void gc_chase_ptr_fields(const heap_object *p) {
    for (int i = 0; i < p->metadata->num_ptr_fields; i++) {
        int offset_of_ptr_field = p->metadata->field_offsets[i];
        void *ptr_to_ptr_field = ((void *)p) + offset_of_ptr_field;
        heap_object **ptr_to_obj_ptr_field = (heap_object **) ptr_to_ptr_field;
        heap_object *target_obj = *ptr_to_obj_ptr_field;
        if (target_obj != NULL) {
            mark_object(target_obj);
        }
    }
}
Пример #28
0
template <class T> inline void MarkSweep::follow_root(T* p) {
  assert(!Universe::heap()->is_in_reserved(p),
         "roots shouldn't be things within the heap");
  T heap_oop = oopDesc::load_heap_oop(p);
  if (!oopDesc::is_null(heap_oop)) {
    oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
    if (!obj->mark()->is_marked()) {
      mark_object(obj);
      follow_object(obj);
    }
  }
  follow_stack();
}
Пример #29
0
static void mark() {
    for (int i = 0; i < num_roots; i++) {
        if (DEBUG) printf("root[%d]=%p\n", i, _roots[i]);
        heap_object *p = *_roots[i];
        if (p != NULL) {
            if (ptr_is_in_heap(p)) {
                mark_object(p);
            }
        }
        else if ( DEBUG ) {
            if (DEBUG) printf("root[%d]=%p -> %p INVALID\n", i, _roots[i], p);
        }
    }
}
Пример #30
0
void
mark_byte_stack (void)
{
  struct byte_stack *stack;
  Lisp_Object *obj;

  for (stack = byte_stack_list; stack; stack = stack->next)
    {
      /* If STACK->top is null here, this means there's an opcode in
	 Fbyte_code that wasn't expected to GC, but did.  To find out
	 which opcode this is, record the value of `stack', and walk
	 up the stack in a debugger, stopping in frames of Fbyte_code.
	 The culprit is found in the frame of Fbyte_code where the
	 address of its local variable `stack' is equal to the
	 recorded value of `stack' here.  */
      eassert (stack->top);

      for (obj = stack->bottom; obj <= stack->top; ++obj)
	mark_object (*obj);

      mark_object (stack->byte_string);
      mark_object (stack->constants);
    }
}