void * tl_alloc(tl_mempool_t *pool, size_t size) { size_t aligned_size = ALIGN_UP(size, CACHE_LINE_SIZE/2); pool_bucket_t *bucket; pool_bucket_t *tmp; void *ptr; assert(aligned_size >= size); assert(aligned_size <= pool->chunk_size); bucket = pthread_getspecific(pool->key); if (bucket == NULL || bucket->offset + size > pool->chunk_size) { tmp = bucket; if ((bucket = malloc(sizeof(pool_bucket_t) + pool->chunk_size)) == NULL) return NULL; bucket->prev = tmp; bucket->offset = aligned_offset(bucket->data, CACHE_LINE_SIZE/2); pthread_setspecific(pool->key, bucket); } ptr = bucket->data + bucket->offset; bucket->offset += aligned_size; return ptr; }
bool TAO::TypeCode::marshal (TAO_OutputCDR & cdr, CORBA::TypeCode_ptr tc, CORBA::ULong offset) { // Marshal the TypeCode TCKind and TypeCode body. // // Update the offset value in case a recursive TypeCode is being // marshaled. return tc != 0 && tc->tao_marshal_kind (cdr) && tc->tao_marshal (cdr, aligned_offset (offset) + sizeof (CORBA::ULong)); }
int Bytecode_tableswitch::dest_offset_at(int i) const { address x = aligned_addr_at(1); int x2 = aligned_offset(1 + (3 + i)*jintSize); int val = java_signed_word_at(x2); return java_signed_word_at(aligned_offset(1 + (3 + i)*jintSize)); }