Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Enable BSTR Field Marshaller for x-plat #20264

Merged
merged 8 commits into from
Oct 11, 2018

Conversation

luqunl
Copy link

@luqunl luqunl commented Oct 4, 2018

Enable Marshalling BSTR as field in PInvoke for x-plat

@luqunl luqunl changed the title [WIP]Enable BSTR Field Marshaller for x-plat Enable BSTR Field Marshaller for x-plat Oct 9, 2018
@luqunl
Copy link
Author

luqunl commented Oct 10, 2018

@dotnet-bot test Ubuntu arm Cross Checked Innerloop Build and Test please

@luqunl
Copy link
Author

luqunl commented Oct 10, 2018

@dotnet-bot test Windows_NT arm Cross Debug Innerloop Build please

@luqunl
Copy link
Author

luqunl commented Oct 10, 2018

@dotnet-bot test Ubuntu16.04 arm64 Cross Checked Innerloop Build and Test please

@luqunl
Copy link
Author

luqunl commented Oct 10, 2018

@jashook, Would you take a look changes in src/vm/callingconvention.h and src/vm/methodtable.cpp

Copy link

@jashook jashook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little weird to remove the BSTR from the FEATURE_COMINTEROP definitions. It seems like it naturally is included in that definition. I understand you are removing it to not enable FEATURE_COMINTEROP cross plat; however, I wonder if it is better to add another define, maybe FEATURE_COMINTEROP_XPLAT or FEATURE_COMINTEROP_WINDOWS for windows specific com_interop. Either way, it is not my expertise so I can let others give their own opinions.

Other than that the change lgtm

@@ -1016,7 +1016,7 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
case ELEMENT_TYPE_VALUETYPE:
{
#ifdef UNIX_AMD64_ABI
MethodTable *pMT = m_argTypeHandle.AsMethodTable();
MethodTable *pMT = m_argTypeHandle.GetMethodTable();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luqunl can you please educate me on why was this change needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some cases, m_argTypeHandle will point to typepamaterdesc instead of methodtable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this comment in typehandle.h

    // Unlike AsMethodTable, GetMethodTable will get the method table
    // of the type, regardless of whether it is an array etc. Note, however
    // this method table may be shared, and some types (like TypeByRef), have
    // no method table (and this function returns NULL for them)
    inline PTR_MethodTable GetMethodTable() const;

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@janvorli
Copy link
Member

It seems a little weird to remove the BSTR from the FEATURE_COMINTEROP definitions.

It feels ok to me. I see the BSTR as just another type, not necessarily COM interop specific.

@luqunl
Copy link
Author

luqunl commented Oct 11, 2018

It feels ok to me. I see the BSTR as just another type, not necessarily COM interop specific.

Yes, We just treat BSTR as a normal 'well know' type which works x-plat.

@luqunl luqunl merged commit ebe631e into dotnet:master Oct 11, 2018
AaronRobinsonMSFT added a commit to AaronRobinsonMSFT/coreclr that referenced this pull request Oct 12, 2018
# Conflicts:
#	src/vm/callingconvention.h
#	tests/src/Interop/StringMarshalling/BSTR/BSTRTest.cs
#	tests/src/Interop/StringMarshalling/BSTR/BSTRTestNative.cpp
#	tests/src/Interop/StringMarshalling/BSTR/PinvokeDef.cs
AaronRobinsonMSFT added a commit that referenced this pull request Oct 16, 2018
* Enable BSTR Marshaling Support for x-plat PInvoke (#19766)

# Conflicts:
#	src/System.Private.CoreLib/src/Microsoft/Win32/Win32Native.cs
#	src/System.Private.CoreLib/src/System/String.CoreCLR.cs
#	src/System.Private.CoreLib/src/System/StubHelpers.cs

* Enable BSTR Field Marshaller for x-plat (#20264)

# Conflicts:
#	src/vm/callingconvention.h
#	tests/src/Interop/StringMarshalling/BSTR/BSTRTest.cs
#	tests/src/Interop/StringMarshalling/BSTR/BSTRTestNative.cpp
#	tests/src/Interop/StringMarshalling/BSTR/PinvokeDef.cs
A-And pushed a commit to A-And/coreclr that referenced this pull request Nov 20, 2018
odhanson pushed a commit to odhanson/coreclr that referenced this pull request Dec 2, 2018
* Enable BSTR Marshaling Support for x-plat PInvoke (dotnet#19766)

# Conflicts:
#	src/System.Private.CoreLib/src/Microsoft/Win32/Win32Native.cs
#	src/System.Private.CoreLib/src/System/String.CoreCLR.cs
#	src/System.Private.CoreLib/src/System/StubHelpers.cs

* Enable BSTR Field Marshaller for x-plat (dotnet#20264)

# Conflicts:
#	src/vm/callingconvention.h
#	tests/src/Interop/StringMarshalling/BSTR/BSTRTest.cs
#	tests/src/Interop/StringMarshalling/BSTR/BSTRTestNative.cpp
#	tests/src/Interop/StringMarshalling/BSTR/PinvokeDef.cs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants