Ejemplo n.º 1
0
void Parse::emit_guard_for_new(ciInstanceKlass* klass) {
  // Emit guarded new
  //   if (klass->_init_thread != current_thread ||
  //       klass->_init_state != being_initialized)
  //      uncommon_trap
  Node* cur_thread = _gvn.transform( new (C, 1) ThreadLocalNode() );
  Node* merge = new (C, 3) RegionNode(3);
  _gvn.set_type(merge, Type::CONTROL);
  Node* kls = makecon(TypeKlassPtr::make(klass));

  Node* init_thread_offset = _gvn.MakeConX(instanceKlass::init_thread_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes());
  Node* adr_node = basic_plus_adr(kls, kls, init_thread_offset);
  Node* init_thread = make_load(NULL, adr_node, TypeRawPtr::BOTTOM, T_ADDRESS);
  Node *tst   = Bool( CmpP( init_thread, cur_thread), BoolTest::eq);
  IfNode* iff = create_and_map_if(control(), tst, PROB_ALWAYS, COUNT_UNKNOWN);
  set_control(IfTrue(iff));
  merge->set_req(1, IfFalse(iff));

  Node* init_state_offset = _gvn.MakeConX(instanceKlass::init_state_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes());
  adr_node = basic_plus_adr(kls, kls, init_state_offset);
  Node* init_state = make_load(NULL, adr_node, TypeInt::INT, T_INT);
  Node* being_init = _gvn.intcon(instanceKlass::being_initialized);
  tst   = Bool( CmpI( init_state, being_init), BoolTest::eq);
  iff = create_and_map_if(control(), tst, PROB_ALWAYS, COUNT_UNKNOWN);
  set_control(IfTrue(iff));
  merge->set_req(2, IfFalse(iff));

  PreserveJVMState pjvms(this);
  record_for_igvn(merge);
  set_control(merge);

  uncommon_trap(Deoptimization::Reason_uninitialized,
                Deoptimization::Action_reinterpret,
                klass);
}
Ejemplo n.º 2
0
int main (){
  Any a2 = Int(1);
  Any a3 = Int(2);
  Any a4 = Int(3);
  int count = 0;
  loop_start_label9: ;
  if(count == a1.i )){ goto label9; }
  Any a14 = Char( a5[count] );
  count++;
  Any a16 = Int(0);
  if ( dataAsInt( a14 ) < dataAsInt( a16 ) ) { goto label10; };
  goto loop_start_label9;
  label9: ;
  goto label11;
  label10: ;
  Any a17 = Bool(false);
  goto label12;
  label11: ;
  a17 = Bool(true);
  label12: ;
  Any a18 = Bool(true);
  Any a11 = f ( a5 );
  println ( a11 );
  return 0;
}
Ejemplo n.º 3
0
TypedValue	&
TypedValue::operator < (TypedValue &t2)
{
	if (type == S_FLOAT || t2.type == S_FLOAT)
		return Bool((FloatValue(nullptr) < t2.FloatValue(nullptr)));
	if (type == S_LONG || t2.type == S_LONG)
		return Bool((LongValue(nullptr) < t2.LongValue(nullptr)));
	return Bool((IntValue(nullptr) < t2.IntValue(nullptr)));
}
Ejemplo n.º 4
0
Any f_char3 ( Any a0, Any a1 ){
  if ( dataAsInt( a0 ) == dataAsInt( a1 ) ) { goto label20; };
  Any a4 = Bool(false);
  goto label21;
  label20: ;
  a4 = Bool(true);
  label21: ;
  return a4;
}
Ejemplo n.º 5
0
Any f_char4 ( Any a0, Any a1 ){
  if ( dataAsInt( a0 ) != dataAsInt( a1 ) ) { goto label22; };
  Any a4 = Bool(false);
  goto label23;
  label22: ;
  a4 = Bool(true);
  label23: ;
  return a4;
}
Ejemplo n.º 6
0
Any f_char7 ( Any a0, Any a1 ){
  Any a3 = Char('z');
  if ( dataAsInt( a0 ) > dataAsInt( a3 ) ) { goto label28; };
  Any a4 = Bool(false);
  goto label29;
  label28: ;
  a4 = Bool(true);
  label29: ;
  return a4;
}
Ejemplo n.º 7
0
Any f_char1 ( Any a0, Any a1 ){
  Any a4 = Char('0');
  if ( dataAsInt( a0 ) > dataAsInt( a4 ) ) { goto label16; };
  Any a5 = Bool(false);
  goto label17;
  label16: ;
  a5 = Bool(true);
  label17: ;
  return a5;
}
Ejemplo n.º 8
0
Any f_char2 ( Any a0, Any a1 ){
  Any a3 = Char('0');
  if ( dataAsInt( a0 ) > dataAsInt( a3 ) ) { goto label18; };
  Any a4 = Bool(false);
  goto label19;
  label18: ;
  a4 = Bool(true);
  label19: ;
  return a4;
}
Ejemplo n.º 9
0
Any f_char5 ( Any a0, Any a1 ){
  Any a3 = Char('0');
  if ( dataAsInt( a0 ) < dataAsInt( a3 ) ) { goto label24; };
  Any a4 = Bool(false);
  goto label25;
  label24: ;
  a4 = Bool(true);
  label25: ;
  return a4;
}
Ejemplo n.º 10
0
Any f_char6 ( Any a0, Any a1 ){
  Any a3 = Char('z');
  if ( dataAsInt( a0 ) < dataAsInt( a3 ) ) { goto label26; };
  Any a4 = Bool(false);
  goto label27;
  label26: ;
  a4 = Bool(true);
  label27: ;
  return a4;
}
Ejemplo n.º 11
0
int main (){
  Any a5 = Bool(true);
  Any a6[] = {a5};
  Any a9 = Int( sizeof( a6 ) / sizeof( a6[0] ) );
  Any a10 = Int(0);
  Any a12 = Int(0);
  Any a13 = a6[a12.i];
  Any a14 = Bool(true);
  Any a4 = x1x_f ( a6 );
  println ( a4 );
  Any a11 = Bool(true);
  a12 = Bool(false);
  Any a13[] = {a11, a12};
  Any a16 = Int( sizeof( a13 ) / sizeof( a13[0] ) );
  Any a17 = Int(0);
  Any a19 = Int(0);
  Any a20 = a13[a19.i];
  Any a21 = Bool(true);
  a10 = x1x_f ( a13 );
  println ( a10 );
  Any a18 = Bool(true);
  a19 = Bool(false);
  a20 = Bool(true);
  Any a21[] = {a18, a19, a20};
  Any a24 = Int( sizeof( a21 ) / sizeof( a21[0] ) );
  Any a25 = Int(0);
  Any a27 = Int(0);
  Any a28 = a21[a27.i];
  Any a29 = Bool(true);
  a17 = x1x_f ( a21 );
  println ( a17 );
  return 0;
}
Ejemplo n.º 12
0
Any f_char8 ( Any a0, Any a1 ){
  Any a2 = Char('a');
  if ( dataAsInt( a2 ) >= dataAsInt( a0 ) ) { goto label30; };
  Any a5 = Char('z');
  if ( dataAsInt( a0 ) < dataAsInt( a5 ) ) { goto label31; };
  label30: ;
  Any a6 = Bool(false);
  goto label32;
  label31: ;
  a6 = Bool(true);
  label32: ;
  return a6;
}
Ejemplo n.º 13
0
void RimeWithWeaselHandler::_ReadClientInfo(UINT session_id, LPWSTR buffer)
{
	std::string app_name;
	std::string client_type;
	// parse request text
	wbufferstream bs(buffer, WEASEL_IPC_BUFFER_LENGTH);
	std::wstring line;
	while (bs.good())
	{
		std::getline(bs, line);
		if (!bs.good())
			break;
		// file ends
		if (line == L".")
			break;
		const std::wstring kClientAppKey = L"session.client_app=";
		if (starts_with(line, kClientAppKey))
		{
			std::wstring lwr = line;
			to_lower(lwr);
			app_name = wcstoutf8(lwr.substr(kClientAppKey.length()).c_str());
		}
		const std::wstring kClientTypeKey = L"session.client_type=";
		if (starts_with(line, kClientTypeKey))
		{
			client_type = wcstoutf8(line.substr(kClientTypeKey.length()).c_str());
		}
	}
    // set app specific options
	if (!app_name.empty())
	{
		RimeSetProperty(session_id, "client_app", app_name.c_str());

		if (m_app_options.find(app_name) != m_app_options.end())
		{
			AppOptions& options(m_app_options[app_name]);
			std::for_each(options.begin(), options.end(), [session_id](std::pair<const std::string, bool> &pair)
			{
				DLOG(INFO) << "set app option: " << pair.first << " = " << pair.second;
				RimeSetOption(session_id, pair.first.c_str(), Bool(pair.second));
			});
		}
	}
	// ime | tsf
	RimeSetProperty(session_id, "client_type", client_type.c_str());
	// inline preedit
	bool inline_preedit = m_ui->style().inline_preedit && (client_type == "tsf");	
	RimeSetOption(session_id, "inline_preedit", Bool(inline_preedit));
	// show soft cursor on weasel panel but not inline
	RimeSetOption(session_id, "soft_cursor", Bool(!inline_preedit));
}
Ejemplo n.º 14
0
Any f_char10 ( Any a0, Any a1 ){
  Any a3 = Char('0');
  if ( dataAsInt( a0 ) <= dataAsInt( a3 ) ) { goto label36; };
  Any a5 = Char('z');
  if ( dataAsInt( a0 ) >= dataAsInt( a5 ) ) { goto label36; };
  if ( dataAsInt( a0 ) < dataAsInt( a1 ) ) { goto label37; };
  label36: ;
  Any a8 = Bool(false);
  goto label38;
  label37: ;
  a8 = Bool(true);
  label38: ;
  return a8;
}
Ejemplo n.º 15
0
Any x1x_isPosNeg ( Any a0 ){
  if(a0.type == INT_TYPE){ goto label39; };
  goto label40;
  label39: ;
  goto label41;
  label40: ;
  goto label42;
  label41: ;
  Any a1 = Bool(true);
  return a1;
  label42: ;
  Any a2 = Bool(false);
  return a2;
}
Ejemplo n.º 16
0
Any f_char9 ( Any a0, Any a1 ){
  Any a3 = Char('0');
  if ( dataAsInt( a0 ) <= dataAsInt( a3 ) ) { goto label33; };
  Any a5 = Char('z');
  if ( dataAsInt( a0 ) >= dataAsInt( a5 ) ) { goto label33; };
  if ( dataAsInt( a0 ) < dataAsInt( a1 ) ) { goto label34; };
  label33: ;
  Any a8 = Bool(false);
  goto label35;
  label34: ;
  a8 = Bool(true);
  label35: ;
  return a8;
}
Ejemplo n.º 17
0
Any x1x_f ( Any a0, Any a1[] ){
  Any a3 = Int(0);
  Any a2 = a3;
  Any a5 = Bool(true);
  if ( dataAsInt( a0 ) == dataAsInt( a5 ) ) { goto label127; };
  goto label128;
  label127: ;
  int count = a1[0];
  loop_start_label129: ;
  if(count == a1[1]){ goto label129; }
  Any a7 = Char( a1[count] );
  count++;
  Any a10 = wyce_add( a2 , a7);
  a2 = a10;
  goto loop_start_label129;
  label129: ;
  goto label130;
  label128: ;
  int count = a1[0];
  loop_start_label130: ;
  if(count == a1[1]){ goto label130; }
  Any a12 = Char( a1[count] );
  count++;
  Any a15 = wyce_sub( a2 , a12);
  a2 = a15;
  goto loop_start_label130;
  label130: ;
  return a2;
}
Ejemplo n.º 18
0
void STBaselineTable::appenddata(int scanno, int cycleno, 
				 int beamno, int ifno, int polno, 
				 int freqid, Double time, 
				 bool apply, 
				 STBaselineFunc::FuncName ftype, 
				 vector<int> fpar, 
				 vector<float> ffpar, 
				 Vector<uInt> mask,
				 vector<float> res,
				 float rms,
				 int nchan, 
				 float cthres,
				 int citer, 
				 float lfthres, 
				 int lfavg, 
				 vector<int> lfedge)
{
  Vector<Int> fparam(fpar.size());
  for (uInt i = 0; i < fpar.size(); ++i) {
    fparam[i] = fpar[i];
  }
  Vector<uInt> edge(lfedge.size());
  for (uInt i = 0; i < lfedge.size(); ++i) {
    edge[i] = lfedge[i];
  }
  appenddata(uInt(scanno), uInt(cycleno), uInt(beamno), 
	     uInt(ifno), uInt(polno), uInt(freqid), time,
	     Bool(apply), ftype, fparam, Vector<Float>(ffpar), 
	     mask, Vector<Float>(res), Float(rms), uInt(nchan), 
	     Float(cthres), uInt(citer), 
	     Float(lfthres), uInt(lfavg), edge);
}
Ejemplo n.º 19
0
      Result<Ranker> Engine::ranker(const String& inStateName)
      {
        auto found = mRankers.find(inStateName);
        if (found != mRankers.end()) {
          Result<Ranker>  value(const_cast<const Ranker&>(found->second));
          return value;
        }

        auto optState =
          mCollection.states().optionalObjectWithName(inStateName);
        if (!optState)
          return undefined_state_error(inStateName);

        State& state(*optState);

        auto data = dataFromState(state, mCollection.utterance_index());
        auto record = state.rankerModel().at(State::PARAMETERS_KEY, Record());
        auto rankerModel = state.rankerModel();
        
        if (usingLookupTable()) {
          rankerModel.replace(UtteranceCLRankerModel::USE_LOOKUP_TABLE_KEY,
                              Bool(true));
        }
        
        auto rankerResult = RankerFactory::sharedInstance().make(
          rankerModel, data, record.allValuesOfType<double>());

        if (rankerResult) {
          auto pair = mRankers.emplace(inStateName, rankerResult.value());
          return pair.first->second;
        }

        return rankerResult;
      }
Ejemplo n.º 20
0
void CStdDeserializer::ScriptString(const char* name, JS::MutableHandleString out)
{
#if BYTE_ORDER != LITTLE_ENDIAN
#error TODO: probably need to convert JS strings from little-endian
#endif

	JSContext* cx = m_ScriptInterface.GetContext();
	JSAutoRequest rq(cx);

	bool isLatin1;
	Bool("isLatin1", isLatin1);
	if (isLatin1)
	{
		std::vector<JS::Latin1Char> str;
		ReadStringLatin1(name, str);

		out.set(JS_NewStringCopyN(cx, (const char*)str.data(), str.size()));
		if (!out)
			throw PSERROR_Deserialize_ScriptError("JS_NewStringCopyN failed");
	}
	else
	{
		utf16string str;
		ReadStringUTF16(name, str);

		out.set(JS_NewUCStringCopyN(cx, (const char16_t*)str.data(), str.length()));
		if (!out)
			throw PSERROR_Deserialize_ScriptError("JS_NewUCStringCopyN failed");
	}
}
Ejemplo n.º 21
0
/**
 * Xlib-based handling of xcb events for glamor.
 *
 * We need to let the Xlib event filtering run on the event so that
 * Mesa's dri2_glx.c userspace event mangling gets run, and we
 * correctly get our invalidate events propagated into the driver.
 */
void
ephyr_glamor_process_event(xcb_generic_event_t *xev)
{

    uint32_t response_type = xev->response_type & 0x7f;
    /* Note the types on wire_to_event: there's an Xlib XEvent (with
     * the broken types) that it returns, and a protocol xEvent that
     * it inspects.
     */
    Bool (*wire_to_event)(Display *dpy, XEvent *ret, xEvent *event);

    XLockDisplay(dpy);
    /* Set the event handler to NULL to get access to the current one. */
    wire_to_event = XESetWireToEvent(dpy, response_type, NULL);
    if (wire_to_event) {
        XEvent processed_event;

        /* OK they had an event handler.  Plug it back in, and call
         * through to it.
         */
        XESetWireToEvent(dpy, response_type, wire_to_event);
        xev->sequence = LastKnownRequestProcessed(dpy);
        wire_to_event(dpy, &processed_event, (xEvent *)xev);
    }
    XUnlockDisplay(dpy);
}
Ejemplo n.º 22
0
 // TODO: The behavior of N/A in vector is not fixed yet (#107).
 Bool operator!=(const Vector &rhs) const {
   Bool has_not_equal_size = (size_ != rhs.size_);
   if (has_not_equal_size.is_false()) {
     return Bool(std::memcmp(data_, rhs.data_,
                             sizeof(Int) * raw_size()) != 0);
   }
   return has_not_equal_size;
 }
Ejemplo n.º 23
0
 // TODO: The behavior of N/A in vector is not fixed yet (#107).
 Bool operator==(const Vector &rhs) const {
   Bool has_equal_size = (size_ == rhs.size_);
   if (has_equal_size.is_true()) {
     return Bool(std::memcmp(data_, rhs.data_,
                             sizeof(Int) * raw_size()) == 0);
   }
   return has_equal_size;
 }
Ejemplo n.º 24
0
 unique_ptr<QueryRuntimeFilter> BuildFilter(std::string* parse_error) {
     try {
         WS();
         return Bool();
     } catch (parse_exception& e) {
         *parse_error = e.what();
         return nullptr;
     }
 }
Ejemplo n.º 25
0
Expr Not::make(Expr a) {
    internal_assert(a.defined()) << "Not of undefined\n";
    internal_assert(a.type().is_bool()) << "argument of Not is not a bool\n";

    Not *node = new Not;
    node->type = Bool(a.type().width);
    node->a = a;
    return node;
}
Ejemplo n.º 26
0
Bool StringSet::Set(const Size Index, const Size Offset, const Size Count)
{
  Bool result = false;
  if (Index < m_ElementCount)
  {
    result = true;
    m_Elements[Index] = {Offset, Count};
  }
  return Bool();
}
Ejemplo n.º 27
0
 unique_ptr<QueryRuntimeFilter> Array() {
     if (!Consume("["))
         Error("[");
     kb_.PushArray();
     unique_ptr<QueryRuntimeFilter> filter = Bool();
     kb_.PopArray();
     if (!Consume("]"))
         Error("]");
     return filter;
 }
Ejemplo n.º 28
0
Expr GE::make(Expr a, Expr b) {
    internal_assert(a.defined()) << "GE of undefined\n";
    internal_assert(b.defined()) << "GE of undefined\n";
    internal_assert(a.type() == b.type()) << "GE of mismatched types\n";

    GE *node = new GE;
    node->type = Bool(a.type().width);
    node->a = a;
    node->b = b;
    return node;
}
Ejemplo n.º 29
0
Expression *BoolExp::optimize(int result)
{   Expression *e;

    e1 = e1->optimize(result);
    if (e1->isConst() == 1)
    {
	e = Bool(type, e1);
    }
    else
	e = this;
    return e;
}
Ejemplo n.º 30
0
Any conflict ( Any a0, Any a1, Any a2 ){
  Any a5 = Int( ((Any**)a0.ptr)[0]->i);
  Any a6 = Int( ((Any**)a0.ptr)[1]->i);
  if ( dataAsInt( a5 ) == dataAsInt( a1 ) ) { goto label67; };
  if ( dataAsInt( a6 ) != dataAsInt( a2 ) ) { goto label68; };
  label67: ;
  Any a11 = Bool(true);
  return a11;
  label68: ;
  Any a16 = sub( a6 , a2);
  Any a13 = abs ( a16 );
  Any a21 = sub( a5 , a1);
  Any a18 = abs ( a21 );
  if ( dataAsInt( a13 ) == dataAsInt( a18 ) ) { goto label69; };
  Any a24 = Bool(false);
  goto label70;
  label69: ;
  a24 = Bool(true);
  label70: ;
  return a24;
}