STDMETHODIMP CCeeGen::AllocateMethodBuffer(ULONG cchBuffer, UCHAR **lpBuffer, ULONG *RVA)
{
    HRESULT hr = S_OK;
    BEGIN_ENTRYPOINT_NOTHROW;

    ULONG methodOffset = 0;

    if (! cchBuffer)
        IfFailGo(E_INVALIDARG);
    if (! lpBuffer || ! RVA)
        IfFailGo(E_POINTER);
    *lpBuffer = (UCHAR*) getIlSection().getBlock(cchBuffer, 4); // Dword align
    IfNullGo(*lpBuffer);

        // have to compute the method offset after getting the block, not
        // before (since alignment might shift it up 
    // for in-memory, just return address and will calc later
    methodOffset = getIlSection().dataLen() - cchBuffer;

    *RVA = methodOffset;

ErrExit:
    END_ENTRYPOINT_NOTHROW;

    return hr;
}
Example #2
0
STDMETHODIMP CCeeGen::AllocateMethodBuffer(ULONG cchBuffer, UCHAR **lpBuffer, ULONG *RVA)
{
	if (! cchBuffer)
		return E_INVALIDARG;
	if (! lpBuffer || ! RVA)
		return E_POINTER;
    *lpBuffer = (UCHAR*) getIlSection().getBlock(cchBuffer, 4);	// Dword align
	if (!*lpBuffer)
		return E_OUTOFMEMORY;
		// have to compute the method offset after getting the block, not
		// before (since alignment might shift it up 
    ULONG methodOffset = getIlSection().dataLen() - cchBuffer;
	// for in-memory, just return address and will calc later
	*RVA = methodOffset;
	return S_OK;
}
Example #3
0
STDMETHODIMP CCeeGen::GetMethodBuffer(ULONG RVA, UCHAR **lpBuffer)
{
	if (! lpBuffer)
		return E_POINTER;
    *lpBuffer = (UCHAR*)getIlSection().computePointer(RVA);
	if (*lpBuffer)
		return S_OK;
	return E_FAIL;
}
STDMETHODIMP CCeeGen::GetMethodBuffer(ULONG RVA, UCHAR **lpBuffer)
{
    HRESULT hr = E_FAIL;
    BEGIN_ENTRYPOINT_NOTHROW;

    if (! lpBuffer)
        IfFailGo(E_POINTER);
    *lpBuffer = (UCHAR*)getIlSection().computePointer(RVA);


ErrExit:
    END_ENTRYPOINT_NOTHROW;

    if (*lpBuffer)
        return S_OK;

    return hr;
}
Example #5
0
STDMETHODIMP CCeeGen::SetInitialGrowth(DWORD growth)
{
    getIlSection().SetInitialGrowth(growth);

    return S_OK;
}