Skip to content

Instantly share code, notes, and snippets.

@stormbrew
Created October 21, 2011 23:49
Show Gist options
  • Save stormbrew/1305290 to your computer and use it in GitHub Desktop.
Save stormbrew/1305290 to your computer and use it in GitHub Desktop.
C++ code:
Data * data = m_cur_chunk->alloc(alloc_size);
data->init(size, type, m_cur_pool, false);
Data * alloc(size_t size)
{
Data * ret = (Data*)(m_data + m_used);
m_used += size;
return ret;
}
void init(uint32_t count, uint16_t type, bool pool, bool pin){
m_count = count;
m_type = type;
// note: the following are bitfields, but I don't think they factor in
m_forward = false;
m_pool = pool;
m_pinned = pin;
}
Disassembly:
0x00000001003be0eb <_ZN8Channel92GC9Semispace5Chunk5allocEm+0>: lea rdx,[r8+0x10]
0x00000001003be0ef <_ZN8Channel92GC9Semispace5Chunk5allocEm+4>: lea rcx,[rdx+r10]
0x00000001003be0f3 <_ZN8Channel92GC9Semispace5Chunk5allocEm+8>: lea eax,[r11+r9]
0x00000001003be0f7 <_ZN8Channel92GC9Semispace5Chunk5allocEm+12>: mov DWORD PTR [r8+0xc],eax
0x00000001003be0fb <_ZN8Channel92GC9Semispace4nextEmt+75>: mov QWORD PTR [rbp-0x50],0x1305
0x00000001003be103 <_ZN8Channel92GC9Semispace4nextEmt+83>: mov QWORD PTR [rbp-0x48],rdx
0x00000001003be107 <_ZN8Channel92GC9Semispace4nextEmt+87>: mov QWORD PTR [rbp-0x40],rcx
0x00000001003be10b <_ZN8Channel92GC9Semispace4nextEmt+91>: mov QWORD PTR [rbp-0x38],r9
0x00000001003be10f <_ZN8Channel92GC9Semispace4nextEmt+95>: mov QWORD PTR [rbp-0x30],0x0
0x00000001003be117 <_ZN8Channel92GC9Semispace4nextEmt+103>: mov QWORD PTR [rbp-0x28],0x0
0x00000001003be11f <_ZN8Channel92GC9Semispace4nextEmt+111>: lea rax,[rbp-0x50]
0x00000001003be123 <_ZN8Channel92GC9Semispace4nextEmt+115>: xor edx,edx
0x00000001003be125 <_ZN8Channel92GC9Semispace4nextEmt+117>: rol rdi,0x3
0x00000001003be129 <_ZN8Channel92GC9Semispace4nextEmt+121>: rol rdi,0xd
0x00000001003be12d <_ZN8Channel92GC9Semispace4nextEmt+125>: rol rdi,0x3d
0x00000001003be131 <_ZN8Channel92GC9Semispace4nextEmt+129>: rol rdi,0x33
0x00000001003be135 <_ZN8Channel92GC9Semispace4nextEmt+133>: xchg rbx,rbx
0x00000001003be138 <_ZN8Channel92GC9Semispace4nextEmt+136>: mov QWORD PTR [rbp-0x18],rdx
0x00000001003be13c <_ZN8Channel92GC9Semispace4nextEmt+140>: mov rax,QWORD PTR [rbp-0x18]
0x00000001003be140 <_ZN8Channel92GC9Semispace4nextEmt+144>: mov eax,DWORD PTR [rdi+0x10]
0x00000001003be143 <_ZN8Channel92GC9Semispace4nextEmt+147>: test eax,eax
0x00000001003be145 <_ZN8Channel92GC9Semispace4Data4initEjtbb+0>: mov DWORD PTR [rcx],esi
0x00000001003be147 <_ZN8Channel92GC9Semispace4Data4initEjtbb+2>: mov WORD PTR [rcx+0x4],bx
0x00000001003be14b <_ZN8Channel92GC9Semispace4Data4initEjtbb+6>: setne dl
0x00000001003be14e <_ZN8Channel92GC9Semispace4Data4initEjtbb+9>: add edx,edx
0x00000001003be150 <_ZN8Channel92GC9Semispace4Data4initEjtbb+11>: movzx eax,BYTE PTR [rcx+0x6]
What is the middle part of the disasm doing??
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment