Esempio n. 1
0
  void PolyInlineCache::bootstrap(STATE) {
    GO(poly_inline_cache).set(state->memory()->new_class<Class, PolyInlineCache>(
          state, G(call_site), G(rubinius), "PolyInlineCache"));

    GO(inline_cache_entry).set(state->memory()->new_class<Class, InlineCacheEntry>(
          state, G(call_site), G(rubinius), "InlineCacheEntry"));
  }
Esempio n. 2
0
  void CompiledMethod::init(STATE) {
    GO(cmethod).set(state->new_class("CompiledMethod", G(executable)));
    G(cmethod)->set_object_type(state, CompiledMethodType);

    GO(cmethod_vis).set(state->new_class("Visibility", G(object), G(cmethod)));
    G(cmethod_vis)->set_object_type(state, MethodVisibilityType);
  }
Esempio n. 3
0
  void Regexp::init(STATE) {
    onig_init();
    GO(regexp).set(state->new_class("Regexp", G(object), 0));
    G(regexp)->set_object_type(state, RegexpType);

    GO(matchdata).set(state->new_class("MatchData", G(object), 0));
    G(matchdata)->set_object_type(state, MatchDataType);
  }
Esempio n. 4
0
  void Selector::init(STATE) {
    GO(selectors).set(LookupTable::create(state));
    Class* cls = state->new_class("Selector", G(object), G(rubinius));
    cls->set_object_type(state, SelectorType);
    cls->name(state, state->symbol("Rubinius::Selector"));

    GO(selector).set(cls);

    cls->set_const(state, state->symbol("ALL"), G(selectors));
  }
Esempio n. 5
0
  void VM::bootstrap_symbol() {
#define add_sym(name) GO(sym_ ## name).set(symbol(#name))
    add_sym(object_id);
    add_sym(method_missing);
    add_sym(inherited);
    add_sym(from_literal);
    add_sym(method_added);
    add_sym(send);
    add_sym(public);
    add_sym(private);
    add_sym(protected);
    add_sym(undef);
    add_sym(const_missing);
    add_sym(object_id);
    add_sym(call);
    add_sym(coerce_into_array);
#undef add_sym
    GO(sym_s_method_added).set(symbol("singleton_method_added"));
    GO(sym_init_copy).set(symbol("initialize_copy"));
    GO(sym_plus).set(symbol("+"));
    GO(sym_minus).set(symbol("-"));
    GO(sym_equal).set(symbol("=="));
    GO(sym_nequal).set(symbol("!="));
    GO(sym_tequal).set(symbol("==="));
    GO(sym_lt).set(symbol("<"));
    GO(sym_gt).set(symbol(">"));
  }
Esempio n. 6
0
  /* Register the List and List::Node classes as globals */
  void List::init(STATE) {
    Class* cls;
    cls = ontology::new_class_under(state, "List", G(rubinius));

    GO(list).set(cls);
    cls->set_object_type(state, ListType);

    GO(list_node).set(ontology::new_class_under(state,
          "Node", cls));

    G(list_node)->set_object_type(state, ListNodeType);
  }
Esempio n. 7
0
  /* Creates the rubinius object universe from scratch. */
  void VM::bootstrap_ontology() {

    /*
     * Bootstrap everything so we can create fully initialized
     * Classes.
     */
    bootstrap_class();

    /*
     * Everything is now setup for us to make fully initialized
     * classes.
     */

    /*
     * Create our Rubinius module that we hang stuff off
     */

    initialize_fundamental_constants();

    bootstrap_symbol();
    initialize_builtin_classes();
    bootstrap_exceptions();

    /*
     * Create any 'stock' objects
     */

    Object* main = new_object<Object>(G(object));
    GO(main).set(main);
    G(object)->set_const(this, "MAIN", main); // HACK test hooking up MAIN

    Object* undef = new_object<Object>(G(object));
    GO(undefined).set(undef);

    GO(vm).set(new_class_under("VM", G(rubinius)));
    G(vm)->name(state, state->symbol("Rubinius::VM"));

    Module* type = new_module("Type", G(rubinius));
    type->name(state, state->symbol("Rubinius::Type"));

    System::bootstrap_methods(this);
    Module::bootstrap_methods(this);
    StaticScope::bootstrap_methods(this);
    VariableScope::bootstrap_methods(this);

    /*
     * Setup the table we use to store ivars for immediates
     */

    GO(external_ivars).set(LookupTable::create(this));

    initialize_platform_data();
  }
Esempio n. 8
0
  /* Register the List and List::Node classes as globals */
  void List::init(STATE) {
    Class* cls;
    cls = state->new_class_under("List", G(rubinius));

    GO(list).set(cls);
    cls->set_object_type(state, ListType);
    G(list)->name(state, state->symbol("Rubinius::List"));

    GO(list_node).set(state->new_class("Node", G(object), cls));

    G(list_node)->set_object_type(state, ListNodeType);
  }
Esempio n. 9
0
  void Thread::init(STATE) {
    Tuple* tup = Tuple::from(state, 3,
                             List::create(state),
                             List::create(state),
                             List::create(state) );

    GO(scheduled_threads).set(tup);

    GO(thread).set(state->new_class("Thread", G(object), Thread::fields));
    G(thread)->set_object_type(state, Thread::type);

    G(thread)->set_const(state, "ScheduledThreads", tup);
  }
Esempio n. 10
0
File: 776.c Progetto: DavidToca/acm
static void fill(int x, int y, int c)
{
	int stp;
	char m;

	stp = 0;
	st[stp++] = x;
	st[stp++] = y;
	m = map[y][x];
	assign[y][x] = c;

	while (stp >= 2) {
		y = st[--stp];
		x = st[--stp];

#define GO(Y,X) if (map[Y][X] == m && assign[Y][X] == 0) \
		      { assign[Y][X] = c; st[stp++] = (X); st[stp++] = (Y); }

		if (y > 0) {
			if (x > 0) GO(y - 1, x - 1);
			GO(y - 1, x);
			if ((x + 1) < width) GO(y - 1, x + 1);
		}

		if (x > 0) GO(y, x - 1);
		if ((x + 1) < width) GO(y, x + 1);

		if ((y + 1) < height) {
			if (x > 0) GO(y + 1, x - 1);
			GO(y + 1, x);
			if ((x + 1) < width) GO(y + 1, x + 1);
		}
#undef GO
	}
}
Esempio n. 11
0
  void CallSite::bootstrap(STATE) {
    GO(call_site).set(state->memory()->new_class<Class, CallSite>(
          state, G(rubinius), "CallSite"));

    max_caches = state->shared().config.machine_call_site_cache_limit.value;
    max_evictions = state->shared().config.machine_call_site_eviction_limit.value;
  }
Esempio n. 12
0
  void NativeMethod::init(STATE) {
    GO(nmethod).set(ontology::new_class(state, "NativeMethod",
          G(executable), G(rubinius)));
    G(nmethod)->set_object_type(state, NativeMethodType);

    init_thread(state);
  }
Esempio n. 13
0
			bool get(uint64_t i) const
			{
				assert ( i < n );

				uint64_t const block = i / blocksize;
				i -= block*blocksize;

				uint64_t const blockptr = getBlockPointer(block);
				uint64_t const wordoff = (blockptr / (8*sizeof(uint64_t)));
				uint64_t const bitoff = blockptr % (8*sizeof(uint64_t));

				::libmaus2::util::GetObject<uint64_t const *> GO(data.begin() + wordoff);
				::libmaus2::gamma::GammaDecoder < ::libmaus2::util::GetObject<uint64_t const *> > GD(GO);
				if ( bitoff )
					GD.decodeWord(bitoff);

				GD.decodeWord(rankaccbits); // 1 bit accumulator
				bool sym = GD.decodeWord(1);

				uint64_t rl = GD.decode()+1;

				while ( i >= rl )
				{
					i -= rl;
					sym = ! sym;
					rl = GD.decode()+1;
				}

				return sym;
			}
Esempio n. 14
0
 static bool compare(CommPtr comm, Read<Real> a, Read<Real> b, Real tol,
     Real floor, Int ncomps, Int dim) {
   if (comm->reduce_and(are_close(a, b, tol, floor))) return true;
   /* if floating point arrays are different, we find the value with the
      largest relative difference and print it out for users to determine
      whether this is actually a serious regression
      (and where in the mesh it is most serious)
      or whether tolerances simply need adjusting */
   auto ah = HostRead<Real>(a);
   auto bh = HostRead<Real>(b);
   LO max_i = -1;
   Real max_diff = 0.0;
   for (LO i = 0; i < ah.size(); ++i) {
     auto diff = rel_diff_with_floor(ah[i], bh[i], floor);
     if (diff > max_diff) {
       max_i = i;
       max_diff = diff;
     }
   }
   auto global_start = comm->exscan(GO(ah.size()), OMEGA_H_SUM);
   auto global_max_diff = comm->allreduce(max_diff, OMEGA_H_MAX);
   I32 rank_cand = ArithTraits<I32>::max();
   if (max_diff == global_max_diff) rank_cand = comm->rank();
   auto best_rank = comm->allreduce(rank_cand, OMEGA_H_MIN);
   if (comm->rank() == best_rank) {
     auto global_max_i = global_start + max_i;
     auto ent_global = global_max_i / ncomps;
     auto comp = global_max_i % ncomps;
     std::cout << "max diff at " << singular_names[dim] << " " << ent_global
               << ", comp " << comp << ", values " << ah[max_i] << " vs "
               << bh[max_i] << '\n';
   }
   comm->barrier();
   return false;
 }
static void sys_zone2(void)
{
   uint_t numzones = x0 + 1;

   GO(SYS_zone, "(ZONE_LIST_DEFUNCT) 2s 1m");
   SY(SYS_zone, x0 + ZONE_LIST_DEFUNCT, x0 + 1, &numzones); SUCC;
}
Esempio n. 16
0
bool Graph_Completer::sort_everything()
{
    Graph_Cyclic_Sorter<Point> GCS(G_);
    unsigned int i=1, N = G_->nb_vertices();
    while (i<N && GCS.neighbors_cyclic_sort(i))
    {
        i++;
    }

    G_->extract_abstract_graph(*output_abstract_graph_);
    G_->remove_vertex_by_index(0);

    Graph_Orienter<Point> GO(G_);
    for (i=0; i<G_->nb_vertices(); i++)
    {
        if (!GO.are_neighbors_correctly_oriented(i))
        {
            G_->reverse_neighbors_by_index(i);
            output_abstract_graph_->reverse_neighbors_by_index(i+1);
        }
    }

    *output_angle_ = G_->direction_from_center_of_mass(0);

    return (i==N);
}
Esempio n. 17
0
  void AtomicReference::init(STATE) {
    GO(atomic_ref).set(ontology::new_class(state,
          "AtomicReference", G(object), G(rubinius)));

    G(atomic_ref)->set_object_type(state, AtomicReferenceType);
    G(atomic_ref)->name(state, state->symbol("Rubinius::AtomicReference"));
  }
Esempio n. 18
0
  void BlockEnvironment::init(STATE) {
    GO(blokenv).set(ontology::new_class(state, "BlockEnvironment", G(object),
                                     G(rubinius)));
    G(blokenv)->set_object_type(state, BlockEnvironmentType);


  }
Esempio n. 19
0
void Numeric::init(STATE) {
    GO(numeric).set(ontology::new_class(state, "Numeric"));
    // We inherit from this type in for example Rational
    // and that class shouldn't have NumericType set since
    // that can cause problems.
    G(numeric)->set_object_type(state, ObjectType);
}
Esempio n. 20
0
 void BlockWrapper::init(STATE) {
   Class* cls = state->new_class("Proc", G(object));
   GO(block_wrapper).set(
       state->new_class("FromBlock", cls, cls));
   G(block_wrapper)->set_object_type(state, BlockEnvironmentType);
   G(block_wrapper)->name(state, state->symbol("Proc::FromBlock"));
 }
Esempio n. 21
0
 void AccessVariable::init(STATE) {
   // HACK test superclass of AccessVariable
   GO(access_variable).set(ontology::new_class(state, 
         "AccessVariable", G(executable), G(rubinius)));
   G(access_variable)->set_object_type(state, AccessVariableType);
   G(access_variable)->name(state, state->symbol("Rubinius::AccessVariable"));
 }
Esempio n. 22
0
int main(void)
{
   int res;
   
   GO(__NR_fork, 2, "0e");
   SY(__NR_fork);

   return(0);
}
Esempio n. 23
0
  void JIT::bootstrap(STATE) {
    Module* jit = state->memory()->new_module<JIT>(state, G(rubinius), "JIT");
    GO(jit).set(jit);

    Class* cls = state->memory()->new_class<Class>(state, G(jit), "CompileRequest");
    G(jit)->compile_class(state, cls);

    G(jit)->compile_list(state, List::create(state));
  }
Esempio n. 24
0
  void Fiber::init(STATE) {
    GO(fiber).set(ontology::new_class(state, "Fiber", G(object), G(rubinius)));
    G(fiber)->set_object_type(state, FiberType);

#ifdef RBX_FIBER_ENABLED
    G(fiber)->set_const(state, "ENABLED", cTrue);
#else
    G(fiber)->set_const(state, "ENABLED", cFalse);
#endif
  }
Esempio n. 25
0
  void Fiber::bootstrap(STATE) {
    GO(fiber).set(state->memory()->new_class<Class, Fiber>(
          state, G(rubinius), "Fiber"));

#ifdef RBX_FIBER_ENABLED
    G(fiber)->set_const(state, "ENABLED", cTrue);
#else
    G(fiber)->set_const(state, "ENABLED", cFalse);
#endif
  }
Esempio n. 26
0
  void Fiber::init(STATE) {
    GO(fiber).set(state->new_class("Fiber", G(object), G(rubinius)));
    G(fiber)->set_object_type(state, FiberType);

#ifdef FIBER_ENABLED
    G(fiber)->set_const(state, "ENABLED", Qtrue);
#else
    G(fiber)->set_const(state, "ENABLED", Qfalse);
#endif
  }
Esempio n. 27
0
 void Executable::bootstrap(STATE) {
   GO(executable).set(state->memory()->new_class<Class, Executable>(
         state, G(rubinius), "Executable"));
   G(executable)->set_const(state, "Experimental", Fixnum::from(eExperimental));
   G(executable)->set_const(state, "Stack", Fixnum::from(eStack));
   G(executable)->set_const(state, "Register", Fixnum::from(eRegister));
   G(executable)->set_const(state, "Parsing", Fixnum::from(eParsing));
   G(executable)->set_const(state, "Assertion", Fixnum::from(eAssertion));
   G(executable)->set_const(state, "Instrumentation", Fixnum::from(eInstrumentation));
 }
int main(void)
{
   /* Uninitialised, but we know px[0] is 0x0. */
   long *px = malloc(sizeof(long));
   x0 = px[0];

   /* SYS_lwp_sigqueue          163 */
   GO(SYS_lwp_sigqueue, "5s 1m");
   SY(SYS_lwp_sigqueue, x0 - 1, x0, x0 + 1, x0, x0 - 1); FAIL;

   return 0;
}
Esempio n. 29
0
 }inline bool Run(){
     int i=n,b=-1,e=0;
     while(i--)if(num[f[i]=i]==1)d[que[e++]=i]=1;
     while(d[que[++b]]&&b!=e)for(EDGE*p=COT2::map[que[b]];p;p=p->next)if(num[p->y]!=1&&--num[f[que[b]]=p->y]==1){
         que[e++]=p->y;
         if(d[que[b]]!=200)d[p->y]=d[que[b]]+1;
     }if(e==b||e-b>50)return 1;
     for(i=m;i--;)ADDQUERY(getint()-1,getint()-1);
     while(e--!=b)CT::stt=CT::tmp,CT::T[que[e]]=CT::I(CT::sT,0,n,COT2::a[que[e]]),GO(que[e],-1);
     while(++i!=m)printf("%d\n",sq[i].ans);
     return 0;
 }
/* Everything starts here. :) */
int main ()
{
	int c, set = 1;
	bool is_immediate_decodable = true;

	while ((c = getc(stdin)) > 0)
	{
		// End of a group.
		if (c == '9')
		{
			fprintf(stdout, output[is_immediate_decodable], set);
			NEW_GROUP();
			is_immediate_decodable = true;
			++set;
		}
		else if (is_immediate_decodable)
		{
			switch (c)
			{
				// End of a code.
				case '\n':
				case ' ':
				case '\t':
				{
					// Checking if is immediate decodable.
					if (PATH_CONTINUES()) {
						is_immediate_decodable = false;
						continue;
					}
					// This is a final node for a code.
					SET_FINAL();
					// A new group takes place.
					NEW_CODE();
					break;
				}

				// 0 or 1.
				default:
				{
					c -= '0';
					GO(c);
					if (IS_FINAL())
						is_immediate_decodable = false;
				}
			}
		}
	}

	return 0;
}