Exemplo n.º 1
0
 void* alloc() {
     if (free_chunks.empty()) {
         int protection = PROT_READ | PROT_WRITE | PROT_EXEC;
         int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT;
         char* addr = (char*)mmap(NULL, region_size, protection, flags, -1, 0);
         for (int i = 0; i < region_size / chunk_size; ++i) {
             free_chunks.push_back(&addr[i * chunk_size]);
         }
     }
     return free_chunks.pop_back_val();
 }
Exemplo n.º 2
0
 SILBasicBlock *pop_back_val() { return ToHandle.pop_back_val(); }