CodeChunk sp::LinkCode(Environment* env, Assembler& masm) { if (masm.outOfMemory()) return CodeChunk(); CodeChunk code = env->AllocateCode(masm.length()); if (!code.address()) return code; masm.emitToExecutableMemory(code.address()); return code; }
void * SourcePawnEngine::AllocatePageMemory(size_t size) { CodeChunk chunk = Environment::get()->AllocateCode(size + sizeof(CodeChunk)); CodeChunk* hidden = (CodeChunk*)chunk.address(); new (hidden) CodeChunk(chunk); return hidden + 1; }