MachSpillCopyNode( Node *n, const RegMask &in, const RegMask &out ) :
   MachIdealNode(), _in(&in), _out(&out), _type(n->bottom_type()) {
   init_class_id(Class_MachSpillCopy);
   init_flags(Flag_is_Copy);
   add_req(NULL);
   add_req(n);
 }
示例#2
0
void SafePointNode::push_monitor(const FastLockNode *lock) {
    // Add a FastLockNode, which points to both the original BoxLockNode (the
    // stack space for the monitor) and the Object being locked.
    const int MonitorEdges = 2;
    assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
    assert(req() == jvms()->endoff(), "correct sizing");
    if (GenerateSynchronizationCode) {
        add_req(lock->box_node());
        add_req(lock->obj_node());
    } else {
        add_req(NULL);
        add_req(NULL);
    }
    jvms()->set_endoff(req());
}
 MachTempNode(MachOper* oper) {
   init_class_id(Class_MachTemp);
   _num_opnds = 1;
   _opnds = _opnd_array;
   add_req(NULL);
   _opnds[0] = oper;
 }
示例#4
0
int add_write(const char *fname, const char *buf, int size, char flags, function_to_call_t *fun) {
    if (fname) {
        aiob *aio = get_aiob();
        memset(aio, 0, sizeof(aiob));
        int fd = open(fname, flags & 1 ? O_CREAT|O_WRONLY
                : O_CREAT|O_WRONLY|O_APPEND, S_IRWXU|S_IRWXG);
        aio->aio_fildes = fd;
        aio->aio_buf = buf;
        aio->aio_nbytes = size;
        struct request *req = get_req();
        req->aio = aio;
        req->fun = fun;
        req->type = awrite;
        assign_svalue_no_free(&req->tmp, sp-2);
        add_req(req);
#ifdef PACKAGE_COMPRESS
        if(flags & 2)
            return aio_gzwrite(aio);
        else
#endif
            return aio_write(aio);
    } else
        error("permission denied\n");
    return 1;
}
示例#5
0
文件: async.c 项目: Elohim/FGmud
void do_stuff(void *(*func)(struct request *), struct request *data){
	if(!thread_started){
		pthread_mutex_init(&mut, NULL);
		pthread_mutex_init(&mem_mut, NULL);
		pthread_mutex_init(&work_mut, NULL);
		pthread_mutex_lock(&mut);
		pthread_t t;
		pthread_create(&t, NULL, &thread_func, NULL);
		thread_started = 1;
	}
	struct stuff *work = get_stuff();
	work->func = func;
	work->data = data;
	work->next = NULL;
	pthread_mutex_lock(&work_mut);
	add_req(data);
	if(lasttodo){
		lasttodo->next = work;
		lasttodo = work;
	} else {
		todo = lasttodo = work;
	}
	pthread_mutex_unlock(&work_mut);
	pthread_mutex_unlock(&mut);
}
示例#6
0
/* CALLBACKS START */
void on_request(uint8_t *public_key, uint8_t *data, uint16_t length)
{
  int n = add_req(public_key);
  wprintw(prompt->window, "\nFriend request from:\n");

  int i;
  for (i = 0; i < 32; ++i) {
    wprintw(prompt->window, "%02x", public_key[i] & 0xff);
  }

  wprintw(prompt->window, "\n");
  wprintw(prompt->window, "Use \"accept %d\" to accept it.\n", n);
  for (i = 0; i < MAX_WINDOW_SLOTS; ++i) {
    if (windows[i].onFriendRequest != NULL)
      windows[i].onFriendRequest(&windows[i], public_key, data, length);
  }
}
示例#7
0
/* CALLBACKS START */
void on_request(uint8_t *public_key, uint8_t *data, uint16_t length, void* userdata)
{
    int n = add_req(public_key);
    wprintw(prompt->window, "\nFriend request from:\n");

    int i;
    for (i = 0; i < KEY_SIZE_BYTES; ++i) {
        wprintw(prompt->window, "%02x", public_key[i] & 0xff);
    }

    wprintw(prompt->window, "\nWith the message: %s\n", data);
    wprintw(prompt->window, "\nUse \"accept %d\" to accept it.\n", n);

    for (i = 0; i < MAX_WINDOW_SLOTS; ++i) {
        if (windows[i].onFriendRequest != NULL)
            windows[i].onFriendRequest(&windows[i], public_key, data, length);
    }
}
示例#8
0
int add_getdir(const char *fname, function_to_call_t *fun) {
    if (fname) {
        aiob *aio= get_aiob();
        memset(aio, 0, sizeof(aiob));
        //printf("fname: %s\n", fname);
        int fd = open(fname, O_RDONLY);
        aio->aio_fildes = fd;
        aio->aio_buf = (char *)MALLOC(sizeof(struct dirent) * max_array_size);
        aio->aio_nbytes = sizeof(struct dirent) * max_array_size;
        struct request *req = get_req();
        req->aio = aio;
        req->fun = fun;
        req->type = agetdir;
        add_req(req);
        return aio_getdir(aio);
    }else
        error("permission denied\n");
    return 1;
}
示例#9
0
int add_read(const char *fname, function_to_call_t *fun) {
    if (fname) {
        aiob *aio = get_aiob();
        memset(aio, 0, sizeof(aiob));
        //printf("fname: %s\n", fname);
        int fd = open(fname, O_RDONLY);
        aio->aio_fildes = fd;
        aio->aio_buf = (char *)MALLOC(READ_FILE_MAX_SIZE);
        aio->aio_nbytes = READ_FILE_MAX_SIZE;
        struct request *req = get_req();
        req->aio = aio;
        req->fun = fun;
        req->type = aread;
        add_req(req);
#ifdef PACKAGE_COMPRESS
        return aio_gzread(aio);
#else
        return aio_read(aio);
#endif
    }else
        error("permission denied\n");
    return 1;
}
 MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachBranchNode(), _vidx(vidx) {
   init_class_id(Class_MachNullCheck);
   add_req(ctrl);
   add_req(memop);
 }
示例#11
0
 void add_opd(Node* n) {
   add_req(n);
 }
示例#12
0
 MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachIdealNode(), _vidx(vidx) {
   init_class_id(Class_MachNullCheck);
   init_flags(Flag_is_Branch | Flag_is_pc_relative);
   add_req(ctrl);
   add_req(memop);
 }
示例#13
0
//=============================================================================
TailJumpNode::TailJumpNode(Node *cntrl, Node *i_o, Node *memory, Node *frameptr, Node *target, Node *ex_oop) : ReturnNode(cntrl, i_o, memory, frameptr, Compile::current()->top()) {
    add_req(target);
    add_req(ex_oop);
}
示例#14
0
//=============================================================================
TailCallNode::TailCallNode(Node *cntrl, Node *i_o, Node *memory, Node *frameptr, Node *retadr, Node *target, Node *moop) : ReturnNode( cntrl, i_o, memory, frameptr, retadr ) {
    add_req(target);
    add_req(moop);
}
示例#15
0
 void add_opd(Node* n) {
   add_req(n);
   _length++;
   assert(_length == req() - 1, "vector length matches edge count");
 }
示例#16
0
 MachSpillCopyNode( Node *n, const RegMask &in, const RegMask &out ) : 
   MachIdealNode(), _in(&in), _out(&out), _type(n->bottom_type()) { add_req(NULL); add_req(n); }