Example #1
0
void
SnapshotWriter::addSlot(const Register &value)
{
    IonSpew(IonSpew_Snapshots, "    slot %u: value (reg %s)", slotsWritten_, value.name());

    writeSlotHeader(JSVAL_TYPE_MAGIC, value.code());
}
Example #2
0
void Login::onRegisterClicked()
{
    //take the user to the registeration page
    Register *reg =  new Register();
    this->hide();
    reg->show();
}
unsigned Processor::call_thiscall_args(Register* obj, const char* args, va_list ap) {
	std::stack<Argument> arg_stack;
	std::unordered_set<unsigned char> used_regs;
	Register esp(*this, ESP, sizeof(void*) * 8);

	unsigned argCount = 0, floatCount = 0, intCount = 0, regCount = 0, stackBytes = 0;

	//Set the object as first argument
	if(obj) {
		if(!isIntArg64Register(intCount, argCount))
			stackBytes += pushSize();
		++argCount;
		++intCount;
		arg_stack.push(obj);
	}

	//Read the arguments in...
	while(args && *args != '\0') {
		if(*args == 'r') {
			Register* reg = va_arg(ap,Register*);
			if(reg->xmm()) {
				if(!isFloatArg64Register(floatCount, argCount))
					stackBytes += pushSize();
				++floatCount;
			}
			else {
				if(!isIntArg64Register(intCount, argCount))
					stackBytes += pushSize();
				++intCount;
			}
			++regCount;
			arg_stack.push(reg);
		}
		else if(*args == 'm') {
 Value* get(Value* self, const std::string& name)
 {
     Register<ListValue> list = new ListValue;
     Register<StringValue> ident = new StringValue(name);
     list->push(ident);
     return invoke(iid, number, static_cast<InterfacePointerValue*>(self), list);
 }
Example #5
0
static OopMap* generate_oop_map(StubAssembler* sasm, bool save_fpu_registers) {
  assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words),
         "mismatch in calculation");
  sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
  int frame_size_in_slots = frame_size_in_bytes / sizeof(jint);
  OopMap* oop_map = new OopMap(frame_size_in_slots, 0);

  int i;
  for (i = 0; i < FrameMap::nof_cpu_regs; i++) {
    Register r = as_Register(i);
    if (r == G1 || r == G3 || r == G4 || r == G5) {
      int sp_offset = cpu_reg_save_offsets[i];
      oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
                                r->as_VMReg());
    }
  }

  if (save_fpu_registers) {
    for (i = 0; i < FrameMap::nof_fpu_regs; i++) {
      FloatRegister r = as_FloatRegister(i);
      int sp_offset = fpu_reg_save_offsets[i];
      oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
                                r->as_VMReg());
    }
  }
  return oop_map;
}
Example #6
0
int nodeThread(node*parent, string cmd)
{
	node*nd = masterRecord.registerNode(parent);
	if (nd == nullptr)
	{
		printf("Error: Node failed to register\n");
		return -1;
	}
	
	printError(3000,"Hello world\n");
	printf("Node [%u] created\n",nd->id);

	while (nd->active)
	{
		if (nd->usrInput && sysState.I_hndle==nd)
		{
			printf("%d >> ",nd->id);
			string input;
			getline(cin, input);

			interpret(input,nd);
		}
	}

	printf("Node [%u] destroyed\n", nd->id);
	masterRecord.deregisterNode(nd);

	return 0;
}
Example #7
0
bool HashJoin::next(){

	// probe right side
	while(rightOp->next()){
		std::vector<Register*> tuple = rightOp->getOutput();
        Register* attributeValue = tuple[this->regIdRight];
		uint64_t hashValue = attributeValue->hash();
		// if hashValue indicates a nonempty bucket of the hash table		
		if(!(this->hashTable.find(hashValue) == this->hashTable.end())){
			// if hashValue matches any s in the bucket
			vector<Register*> matchTuple = this->hashTable.at(hashValue);
			Register* match = matchTuple[this->regIdLeft];
			if(match == attributeValue){
				// store r and s in result
				vector<Register*>::iterator it;
				it = result.begin();	
				for(unsigned i=0; i<tuple.size(); i++){			
					it = result.insert(it, tuple[i]);
				}
				for(unsigned j=0; j<matchTuple.size(); j++){	
					it = result.insert(it, matchTuple[j]);
				}
				return true;
			}
		}
	}

	return false;
}
void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
    assert_different_registers(obj, klass, len);
    if (UseBiasedLocking && !len->is_valid()) {
        assert_different_registers(obj, klass, len, t1, t2);
        movptr(t1, Address(klass, Klass::prototype_header_offset()));
        movptr(Address(obj, oopDesc::mark_offset_in_bytes()), t1);
    } else {
        // This assumes that all prototype bits fit in an int32_t
        movptr(Address(obj, oopDesc::mark_offset_in_bytes ()), (int32_t)(intptr_t)markOopDesc::prototype());
    }
#ifdef _LP64
    if (UseCompressedClassPointers) { // Take care not to kill klass
        movptr(t1, klass);
        encode_klass_not_null(t1);
        movl(Address(obj, oopDesc::klass_offset_in_bytes()), t1);
    } else
#endif
    {
        movptr(Address(obj, oopDesc::klass_offset_in_bytes()), klass);
    }

    if (len->is_valid()) {
        movl(Address(obj, arrayOopDesc::length_offset_in_bytes()), len);
    }
#ifdef _LP64
    else if (UseCompressedClassPointers) {
        xorptr(t1, t1);
        store_klass_gap(obj, t1);
    }
#endif
}
Example #9
0
/**
 * Tell the VFPU to execute an instruction, wait for it to finish, return the result
 * TODO: Make this not mix C++ and C so badly?
 * TODO: It will still only work for magic 32 bit FPU
 */
Register Exec(const Register & a, const Register &  b, Opcode op, Rmode rmode)
{
	assert(g_running);
	stringstream s;
	s << hex << setw(8) << setfill('0') << a.to_ulong() << "\n" << b.to_ulong() << "\n" << setw(1) << op <<"\n" << setw(1) << rmode << "\n";
	string str(s.str());
	//Debug("Writing: %s", str.c_str());

	// So we used C++ streams to make our C string...
	assert(write(g_fpu_socket[1], str.c_str(), str.size()) == (int)str.size());

	char buffer[BUFSIZ]; 
	int len = read(g_fpu_socket[1], buffer, sizeof(buffer));
	//assert(len == 9);
	buffer[--len] = '\0'; // Get rid of newline
	//Debug("Read: %s", buffer);
	
	Register result(0);
	for (int i = 0; i < len/2; ++i)
	{
		unsigned byte; // It is ONE byte (2 nibbles == 2 hex digits)
		sscanf(buffer+2*i, "%02x", &byte);
		result |= (byte << 8*(len/2-i-1));
	}
	
	stringstream s2;
	//TODO: Make it compile on non C++11
	s2 << hex << result.to_ulong();
	//Debug("Result is: %s", s2.str().c_str());
	return result;
}
Example #10
0
//---------------------------------------------------------------------------
int main()
{
   Database db;
   db.open("data/uni");
   Table& studenten=db.getTable("studenten");
   Table& hoeren=db.getTable("hoeren");


	//from Studenten s1, Studenten s2, hoeren h1, hoeren h2
   	unique_ptr<Tablescan> scanStudenten1(new Tablescan(studenten));
	unique_ptr<Tablescan> scanStudenten2(new Tablescan(studenten));
    unique_ptr<Tablescan> scanHoeren1(new Tablescan(hoeren));
	unique_ptr<Tablescan> scanHoeren2(new Tablescan(hoeren));

   	const Register* name1=scanStudenten1->getOutput("name");
   	const Register* name2=scanStudenten2->getOutput("name");
	const Register* matrNr1=scanStudenten1->getOutput("matrnr");
	const Register* matrNr2=scanStudenten2->getOutput("matrnr");
	const Register* matrNrHoeren1=scanHoeren1->getOutput("matrnr");
	const Register* matrNrHoeren2=scanHoeren2->getOutput("matrnr");
	const Register* vorlNrHoeren1=scanHoeren1->getOutput("vorlnr");
	const Register* vorlNrHoeren2=scanHoeren2->getOutput("vorlnr");



	//where s1.Name='Schopenhauer'
	std::string name = "Schopenhauer";
	Register* n = new Register();
	n->setString(name);
	unique_ptr<Selection> select(new Selection(move(scanStudenten1),name1,n));
	
 	//and s1.MatrNr=h1.MatrNr
	unique_ptr<CrossProduct> cp(new CrossProduct(move(select),move(scanHoeren1)));
   	unique_ptr<Selection> select2(new Selection(move(cp),matrNr1,matrNrHoeren1));

 	//and h1.VorlNr=h2.VorlNr 
	unique_ptr<CrossProduct> cp2(new CrossProduct(move(select2),move(scanHoeren2)));
   	unique_ptr<Selection> select3(new Selection(move(cp2),vorlNrHoeren1,vorlNrHoeren2));

	// and h1.MatrNr!=h2.MatrNr 
   unique_ptr<Chi> chi(new Chi(move(select3),Chi::NotEqual,matrNrHoeren1,matrNrHoeren2));
   const Register* chiResult=chi->getResult();
   unique_ptr<Selection> select4(new Selection(move(chi),chiResult));

	//and h2.MatrNr = s2.MatrNr
	unique_ptr<CrossProduct> cp3(new CrossProduct(move(select4),move(scanStudenten2)));
   	unique_ptr<Selection> select5(new Selection(move(cp3),matrNrHoeren2,matrNr2));

	//select s2.Name
   unique_ptr<Projection> project(new Projection(move(select5),{name2}));


   Printer out(move(project));

   out.open();
   while (out.next());
   out.close();

}
Example #11
0
 void WriteRegisters(const Devices::TFM::Registers& regs)
 {
     for (Registers::const_iterator it = regs.begin(), lim = regs.end(); it != lim; ++it)
     {
         const Register reg = *it;
         ::YM2203WriteRegs(Chips[reg.Chip()].get(), reg.Index(), reg.Value());
     }
 }
Example #12
0
bool MemoryMgr::freeRegister(Register r) {
	bool* table = getTable(r.isInt());
	if(r.val() <0 || r.val() >= NUM_REGISTERS || !table[r.val()]){
		return false;
	}
	table[r.val()] = false;
	return true;
}
Example #13
0
  static RegSet range(Register start, Register end) {
    uint32_t bits = ~0;
    bits <<= start->encoding();
    bits <<= 31 - end->encoding();
    bits >>= 31 - end->encoding();

    return RegSet(bits);
  }
Example #14
0
void KAKUtil::encodeRegister(Register &bits, float rotVal) {
    RotateX* rx =  new RotateX();
    int i;
    rx->setPsi(rotVal);

    for ( i = 0; i < bits.getWidth(); i++ ) {
        bits.applyGate(rx, i);
    }
}
void RegisterFile::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
{
    for (Register* it = start(); it != end(); ++it) {
        JSValue v = it->jsValue();
        if (!v.isCell())
            continue;
        conservativeRoots.add(v.asCell());
    }
}
// On SPARC, the %lN and %iN registers are non-volatile.
inline bool frame::volatile_across_calls(Register reg) {
  // This predicate is (presently) applied only to temporary registers,
  // and so it need not recognize non-volatile globals.
  return true; 
  // QQQ
#if 0
  return reg->is_out() || reg->is_global();
#endif
}
Example #17
0
void
SnapshotWriter::addSlot(JSValueType type, const Register &reg)
{
    IonSpew(IonSpew_Snapshots, "    slot %u: %s (%s)",
            slotsWritten_, ValTypeToString(type), reg.name());

    JS_ASSERT(type != JSVAL_TYPE_DOUBLE);
    writeSlotHeader(type, reg.code());
}
Example #18
0
BufferOffset Assembler::DataProcShiftedRegister(const Register& rd, const Register& rn,
                                                const Operand& operand, FlagsUpdate S, Instr op)
{
  VIXL_ASSERT(operand.IsShiftedRegister());
  VIXL_ASSERT(rn.Is64Bits() || (rn.Is32Bits() && is_uint5(operand.shift_amount())));
  return Emit(SF(rd) | op | Flags(S) |
              ShiftDP(operand.shift()) | ImmDPShift(operand.shift_amount()) |
              Rm(operand.reg()) | Rn(rn) | Rd(rd));
}
void Login::on_register_2_clicked()     //注册
{
    Register *reg = new Register();
    reg->setWindowTitle("注册");
    reg->setModal(true);
    reg->show();

    connect(this, SIGNAL(sendDatabaseToRegister(QSqlDatabase)), reg, SLOT(recvDatabaseFromLogin(QSqlDatabase)));
    emit sendDatabaseToRegister(db);
}
Example #20
0
//This function does a branch on equal
void ControlUnit::BEQ(int a, int b, int newPC, Register &r1, MainFrame* theFrame)
{
	if(r1.get(a)==r1.get(b))
	{
		cout<<"BEQ jumping."<<endl;
		setPC(newPC);
	}
	else
		pc++;
};
Example #21
0
void
SnapshotWriter::addSlot(int32_t typeStackIndex, const Register &payload)
{
    IonSpew(IonSpew_Snapshots, "    slot %u: value (t=%d, d=%s)",
            slotsWritten_, typeStackIndex, payload.name());

    writeSlotHeader(JSVAL_TYPE_MAGIC, NUNBOX32_STACK_REG);
    writer_.writeSigned(typeStackIndex);
    writer_.writeByte(payload.code());
}
 // Setter
 virtual bool put(Value* self, Value* value)
 {
     if (dynamic_cast<InterfacePointerValue*>(self) && !readOnly)
     {
         Register<ListValue> list = new ListValue;
         list->push(value);
         invoke(iid, setter, static_cast<InterfacePointerValue*>(self), list);
     }
     return true;
 }
Example #23
0
void
SnapshotWriter::addSlot(const Register &type, int32_t payloadStackIndex)
{
    IonSpew(IonSpew_Snapshots, "    slot %u: value (t=%s, d=%d)",
            slotsWritten_, type.name(), payloadStackIndex);

    writeSlotHeader(JSVAL_TYPE_MAGIC, NUNBOX32_REG_STACK);
    writer_.writeByte(type.code());
    writer_.writeSigned(payloadStackIndex);
}
Example #24
0
void
SnapshotWriter::addSlot(const Register &type, const Register &payload)
{
    IonSpew(IonSpew_Snapshots, "    slot %u: value (t=%s, d=%s)",
            slotsWritten_, type.name(), payload.name());

    writeSlotHeader(JSVAL_TYPE_MAGIC, NUNBOX32_REG_REG);
    writer_.writeByte(type.code());
    writer_.writeByte(payload.code());
}
Example #25
0
//---------------------------------------------------------------------------
void task1()
{
  cout << endl << "***** Find all students that attended the lectures together with Schopenhauer, excluding Schopenhauer himself. *****" << endl;
  
  // open database
  Database db;
  db.open("data/uni");
  
  // FROM
  Table& s1=db.getTable("studenten");
  Table& h1=db.getTable("hoeren");
  Table& s2=db.getTable("studenten");
  Table& h2=db.getTable("hoeren");

  unique_ptr<Tablescan> scan_s1(new Tablescan(s1));
  unique_ptr<Tablescan> scan_h1(new Tablescan(h1));
  unique_ptr<Tablescan> scan_s2(new Tablescan(s2));
  unique_ptr<Tablescan> scan_h2(new Tablescan(h2));

  // columns
  const Register* s1_name=scan_s1->getOutput("name");
  const Register* s2_name=scan_s2->getOutput("name");
  const Register* s1_matrnr=scan_s1->getOutput("matrnr");
  const Register* h1_matrnr=scan_h1->getOutput("matrnr");
  const Register* s2_matrnr=scan_s2->getOutput("matrnr");
  const Register* h2_matrnr=scan_h2->getOutput("matrnr");
  
  // filter s1 and s2 for (in)equality to "Schopenhauer"
  Register schopenhauer; schopenhauer.setString("Schopenhauer");
  
  unique_ptr<Chi> s1_filter(new Chi(move(scan_s1),Chi::Equal,s1_name,&schopenhauer));
  const Register* s1_filtered_result=s1_filter->getResult();
  unique_ptr<Selection> s1_filtered(new Selection(move(s1_filter),s1_filtered_result));
 
  unique_ptr<Chi> s2_filter(new Chi(move(scan_s2),Chi::NotEqual,s2_name,&schopenhauer));
  const Register* s2_filtered_result=s2_filter->getResult();
  unique_ptr<Selection> s2_filtered(new Selection(move(s2_filter),s2_filtered_result));
  
  // join s1, h1
  unique_ptr<HashJoin> hjoin1(new HashJoin(move(s1_filtered),move(scan_h1), s1_matrnr, h1_matrnr));
  // join s2, h2
  unique_ptr<HashJoin> hjoin2(new HashJoin(move(s2_filtered),move(scan_h2), s2_matrnr, h2_matrnr));
  // cross product of both joins
  unique_ptr<CrossProduct> cp(new CrossProduct(move(hjoin1),move(hjoin2)));
  // Project to s2.name
  unique_ptr<Projection> project(new Projection(move(cp),{s2_name}));
  // distinct s2.name
  unique_ptr<Distinct> dist(new Distinct(move(project),{s2_name}));
  
  // print result
  Printer out(move(dist));
  out.open();
  while (out.next());
  out.close();
}
Example #26
0
QString gprComment(const Register& reg)
{
	QString regString;
	int stringLength;
	QString comment;
	if(edb::v1::get_ascii_string_at_address(reg.valueAsAddress(), regString, edb::v1::config().min_string_length, 256, stringLength))
		comment=QString("ASCII \"%1\"").arg(regString);
	else if(edb::v1::get_utf16_string_at_address(reg.valueAsAddress(), regString, edb::v1::config().min_string_length, 256, stringLength))
		comment=QString("UTF16 \"%1\"").arg(regString);
	return comment;
}
static void ExpectRegistered(
		std::string const & iTemporaryRobotId,
		std::string const & iExpectedRobotId,
		std::string const & iExpectedTeam,
		Sender & ioPusher,
		Receiver & ioSubscriber)
{
	Register aRegisterMessage;
	aRegisterMessage.set_temporary_robot_id(iTemporaryRobotId);
	aRegisterMessage.set_video_url("http://localhost:80");
	aRegisterMessage.set_image("this is a photo of the robot.jpg");
	RawMessage aMessage(
			iTemporaryRobotId,
			"Register",
			aRegisterMessage.SerializeAsString());
	ioPusher.send(aMessage);

	RawMessage aResponse;
	if (not Common::ExpectMessage("Registered", ioSubscriber, aResponse))
	{
		ORWELL_LOG_ERROR("Expected Registered but received " << aResponse._type);
		g_status = -1;
	}
	else
	{
		Registered aRegistered;
		aRegistered.ParsePartialFromString(aResponse._payload);

		if (aRegistered.robot_id() != iExpectedRobotId)
		{
			ORWELL_LOG_ERROR("Expected robot ID '" << iExpectedRobotId
					<< "' but received '" << aRegistered.robot_id() << "'");
			g_status = -2;
		}
		if (iExpectedTeam.length() > 0)
		{
			if (aRegistered.has_team())
			{
				ORWELL_LOG_INFO("The robot will be in team: " << aRegistered.team());
				if (iExpectedTeam != aRegistered.team())
				{
					ORWELL_LOG_ERROR("Expected team '" << iExpectedTeam
							<< "' but received '" << aRegistered.team() << "'");
					g_status = -4;
				}
			}
			else
			{
				ORWELL_LOG_ERROR("Expected a team but none found.");
				g_status = -3;
			}
		}
	}
}
Example #28
0
 inline bool operator==(const Register &val) const {
   switch (type) {
     case INTEGER:
       return intValue == val.getIntegerValue();
     case STRING:
       return stringValue == val.getStringValue();
     case UNDEFINED:
       return false;
     default:
       throw std::invalid_argument("invalid state");
   }
 }
Example #29
0
void Internal8085::MCellChanged(QString str){
    str = str.toUpper().rightJustified(2, QLatin1Char('0'));
    int address = (H.toInt() << 8) + L.toInt();
    if(address >= lowAddressLimit && address < upAddressLimit){
        Register *MCell = &cells[address - lowAddressLimit];
        bool ok;
        uint64_t val = str.toLongLong(&ok, 16);
        for(int i = 0;i < MCell->size();++i){
            MCell->setBit(i,(val&(1LL<<(MCell->size() - i - 1))));
        }
    }
}
 CompletionType evaluate()
 {
     Value* message = getScopeChain()->get("message");
     Register<ErrorValue> object = new ErrorValue;
     if (!message->isUndefined())
     {
         Register<Value> value = new StringValue(message->toString());
         object->put("message", value);
     }
     object->setPrototype(prototype);
     return CompletionType(CompletionType::Return, object, "");
 }