Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Where is MethodDesc::Call ??? Framework 4.0

Featured Replies

Posted

Where is MethodDesc::Call ??? Framework 4.0

https://www.oreilly.com/library/view/shared-source-cli/059600351X/ch06s02.html

Quote

execution of managed code can be found in MethodDesc::Call, which we discussed in Chapter 5 (and which can be found in sscli/clr/src/vm/method.cpp).

Is not inside method.cpp, in fact I can't find there any method starting with "Call"
Alternatives? Any other simple way of executing .NET methods at low level?
 

  • Author

@kao: Doesn't help, I need to run methods in Framework 4.0 not on old Framework,
in Framework 4.0 that method "MethodDesc::Call" seems to be missing! Alternatives?
 

@CodeExplorer you can use MethodDesc::GetMultiCallableAddrOfCode function to obtain pointer to the method which you can later invoke,call it with CORINFO_ACCESS_LDFTN and then later on you can invoke the code directly or wrap it up into a managed delagate and invoke like that

Edited by BataBo
More clarification

  • Author

I did find MethodDesc::CallDescr(), but there is a problem:
dotnet-coreclr-master\src\vm\interpreter.cpp

// The m_argDescs array is constructed in the following "canonical" order:
    // 1. 'this' pointer
    // 2. signature arguments
    // 3. return buffer
    // 4. type parameter -or- vararg cookie
    //
    // argOffsets_ is passed in this order, and serves to establish the offsets to arguments
    // when the interpreter is invoked using the native calling convention (i.e., not directly).
    //
    // When the interpreter is invoked directly, the arguments will appear in the same order
    // and form as arguments passed to MethodDesc::CallDescr().  This ordering is as follows:
    // 1. 'this' pointer
    // 2. return buffer
    // 3. signature arguments
    //
    // MethodDesc::CallDescr() does not support generic parameters or varargs functions. (the problem)

MethodDesc::GetMultiCallableAddrOfCode has no parameter, this calls DoPrestub on that method?
 

  • Author

I was wrong, MethodDesc::GetMultiCallableAddrOfCode has one parameter

method.cpp

PCODE MethodDesc::GetMultiCallableAddrOfCode(CORINFO_ACCESS_FLAGS accessFlags /*=CORINFO_ACCESS_LDFTN*/)
{
    CONTRACTL
    {
        THROWS;
        GC_TRIGGERS;
        INJECT_FAULT(COMPlusThrowOM());
    }
    CONTRACTL_END

    PCODE ret = TryGetMultiCallableAddrOfCode(accessFlags);

    if (ret == NULL)
    {
        GCX_COOP();

        // We have to allocate funcptr stub
        ret = GetLoaderAllocator()->GetFuncPtrStubs()->GetFuncPtrStub(this);
    }

    return ret;
}

Unfortunate from what I could see doesn't call DoPrestub!
 

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.