/*\ Asynchronous Read: returns 0 if succeded or -1 if failed \*/ int elio_aread(Fd_t fd, Off_t doffset, void* buf, Size_t bytes, io_request_t * req_id) { off_t offset = (off_t) doffset; Size_t stat; #ifdef AIO int aio_i; #endif #ifdef CRAY int rc; #endif if (doffset >= ABSURDLY_LARGE) ELIO_ERROR(SEEKFAIL,0); /* Follow the linked list of extents down until we hit the file that contains the offset */ if (doffset >= elio_max_file_size(fd)) { Fd_t next_fd = elio_get_next_extent(fd); if (!next_fd) ELIO_ERROR(OPENFAIL,0); doffset -= elio_max_file_size(fd); return elio_aread(next_fd, doffset, buf, bytes, req_id); } /* Figure out if the read continues onto the next extent * ... if so then force the entire request to be done synchronously * so that we don't have to manage multiple async requests */ if ((doffset+((Off_t) bytes)) >= elio_max_file_size(fd)) { *req_id = ELIO_DONE; if (elio_read(fd, doffset, buf, bytes) != bytes) return -1; else return 0; } offset = (off_t) doffset; #ifdef PABLO int pablo_code = PABLO_elio_aread; PABLO_start( pablo_code ); #endif *req_id = ELIO_DONE; #ifdef AIO AIO_LOOKUP(aio_i); /* blocking io when request table is full */ if(aio_i >= MAX_AIO_REQ){ # if defined(DEBUG) fprintf(stderr, "elio_read: Warning- asynch overflow\n"); # endif SYNC_EMULATE(read); } else { *req_id = (io_request_t) aio_i; if((stat=elio_set_cb(fd, offset, aio_i, (void*) buf, bytes))) ELIO_ERROR((int)stat,0); # if defined(CRAY) rc = READA(fd->fd, buf, bytes, &cb_fout[aio_i].stat, DEFARG); stat = (rc < 0)? -1 : 0; # elif defined(AIX) #if !defined(AIX52) && !defined(_AIO_AIX_SOURCE) stat = aio_read(fd->fd, cb_fout+aio_i); #endif # else stat = aio_read(cb_fout+aio_i); # endif aio_req[aio_i] = *req_id; } #else /* call blocking write when AIO not available */ SYNC_EMULATE(read); #endif if(stat ==-1) ELIO_ERROR(AWRITFAIL, 0); #ifdef PABLO PABLO_end(pablo_code); #endif return((int)stat); }
void cgen(QuadSP t) { if (t == NULL) { fprintf(errlist, "ELF BUG:314\n"); return ; } switch (t->op) { case ADD_op: ADDA(t->r, t->s, t->d); break; case SUB_op: SUBA(t->r, t->s, t->d); break; case MUL_op: MULA(t->r, t->s, t->d); break; case DIV_op: DIVA(t->r, t->s, t->d); break; case INC_op: INCA(t->r, t->s, t->d); break; case DEC_op: DECA(t->r, t->s, t->d); break; case NEG_op: NEGA(t->r, t->s, t->d); break; case LOAD_op: LOADA(t->r, t->s, t->d); break; case ASS_op: ASSA(t->r, t->s, t->d); break; case AARR_op: AARRA(t->r, t->s, t->d); break; case EQU_op: EQUA(t->r, t->s, t->d); break; case NEQ_op: NEQA(t->r, t->s, t->d); break; case GTT_op: GTTA(t->r, t->s, t->d); break; case GEQ_op: GEQA(t->r, t->s, t->d); break; case LST_op: LSTA(t->r, t->s, t->d); break; case LEQ_op: LEQA(t->r, t->s, t->d); break; case JMP_op: JMPA(t->r, t->s, t->d); break; case PUSH_op: PUSHA(t->r, t->s, t->d); break; case PUSHA_op: PUSHAA(t->r, t->s, t->d); break; case POP_op: POPA(t->r, t->s, t->d); break; case CALL_op: CALLA(t->r, t->s, t->d); break; case SRET_op: SRETA(t->r, t->s, t->d); break; case ENTER_op: ENTERA(t->r, t->s, t->d); break; case FIN_op: FINA(t->r, t->s, t->d); break; case READ_op: READA(t->r, t->s, t->d); break; case READC_op: READCA(t->r, t->s, t->d); break; case WRS_op: WRSA(t->r, t->s, t->d); break; case WRI_op: WRIA(t->r, t->s, t->d); break; case WRC_op: WRCA(t->r, t->s, t->d); break; case LABEL_op: LABELA(t->r, t->s, t->d); break; default: fprintf(errlist, "ELF BUG:420\n"); } }