Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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;
}