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

Allow users to enable automatic NI bind fallback via command-line #11485

Merged
merged 5 commits into from
May 10, 2017

Conversation

parjong
Copy link

@parjong parjong commented May 10, 2017

This commit allows users to enable #11341 via command-line option. The default behavior remains unchanged.

@parjong
Copy link
Author

parjong commented May 10, 2017

@gkhanna79 @sdmaclea Please take a look.

IMHO, #11324 should be addressed before 2.0 branching out if ARM/Linux also suffers from it, but I currently have no infrastructure to test whether NI image loading works or not.

I currently attempt to build up testing infrastructure, but am not sure whether it is possible before 2.0 branching out.

I submitted this PR first as a workaround.

\CC @hqueue @hseok-oh @jyoungyun @sjsinju @lemmaa


if(NOT DEFINED FEATURE_NI_BIND_FALLBACK)
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
set(FEATURE_IMPLICIT_NI_BIND 1)

Choose a reason for hiding this comment

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

What is meant FEATURE_IMPLICIT_NI_BIND ?

Copy link
Author

Choose a reason for hiding this comment

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

@hseok-oh Thank you!

@@ -689,11 +689,11 @@ namespace BINDER_SPACE
sCoreLib = sCoreLibDir;
sCoreLib.Append(CoreLibName_IL_W);
BOOL fExplicitBindToNativeImage = (fBindToNativeImage == true)? TRUE:FALSE;
#if defined(FEATURE_PAL) && !defined(_TARGET_AMD64_) && !defined(_TARGET_ARM64_)
#if defined(FEATURE_PAL) && !defined(FEATURE_NI_BIND_FALLBACK)
Copy link
Member

Choose a reason for hiding this comment

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

Semantically, "NI_BIND_FALLBACK" happens when we bind as IL, instead of NI. Thus, the define should look like the following:

#if defined(FEATURE_PAL) && defined(FEATURE_NI_BIND_FALLBACK)

@@ -25,3 +25,9 @@ endif(NOT DEFINED FEATURE_DBGIPC)
if(NOT DEFINED FEATURE_INTERPRETER)
set(FEATURE_INTERPRETER 0)
endif(NOT DEFINED FEATURE_INTERPRETER)

if(NOT DEFINED FEATURE_NI_BIND_FALLBACK)
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
Copy link
Member

Choose a reason for hiding this comment

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

This "if" check should be NOT of the existing "if" to account for my comment at https://github.com/dotnet/coreclr/pull/11485/files#r115656309.

@gkhanna79
Copy link
Member

@parjong Thanks for making this - if you can submit an updated PR, we should be able to get this in by EOD tomorrow.

I do think it will be valuable to validate comment from @sdmaclea at #11341 (comment) and confirm Arm32 NI works (which, I believe, it should be because I would assume Tizen would be using NI image of SPC.dll, right?).

@parjong
Copy link
Author

parjong commented May 10, 2017

@gkhanna79 Thanks you for comments. Yes, Tizen release contains S.P.CoreLib.ni.dll in order to reduce application launching time.

@@ -25,3 +25,9 @@ endif(NOT DEFINED FEATURE_DBGIPC)
if(NOT DEFINED FEATURE_INTERPRETER)
set(FEATURE_INTERPRETER 0)
endif(NOT DEFINED FEATURE_INTERPRETER)

if(NOT DEFINED FEATURE_NI_BIND_FALLBACK)
Copy link
Member

Choose a reason for hiding this comment

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

One more suggestion - can you make this entire check under "if not Win32" as that will allow you to remove FEATURE_PAL from https://github.com/dotnet/coreclr/pull/11485/files#diff-1708de55e5220e56e33f7ddb0f465f9cR692?

Copy link
Member

Choose a reason for hiding this comment

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

You should move the NOT WIN32 one level up so that the entire block is within it.

Copy link
Author

@parjong parjong May 10, 2017

Choose a reason for hiding this comment

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

As I understand, the behavior is same if cmakeargs "-DFEATURE_NI_BIND_FALLBACK=..." is absent. Is there another issue that I am not aware of?

Copy link
Member

Choose a reason for hiding this comment

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

Just readability - nothing else :)

Copy link
Author

@parjong parjong May 10, 2017

Choose a reason for hiding this comment

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

How about the following form?

if(WIN32)
  set(FEATURE_NI_BIND_FALLBACK 0)
endif(WIN32)

if(NOT DEFINED FEATURE_NI_BIND_FALLBACK)
  if(NOT CLR_CMAKE_TARGET_ARCH_AMD64 AND NOT CLR_CMAKE_TARGET_ARCH_ARM64)
    set(FEATURE_NI_BIND_FALLBACK 1)
  endif()
endif(NOT DEFINED FEATURE_NI_BIND_FALLBACK)

Copy link
Member

@gkhanna79 gkhanna79 left a comment

Choose a reason for hiding this comment

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

LGTM to modulo one comment.

@sdmaclea @janvorli Please chime in as well.

@parjong
Copy link
Author

parjong commented May 10, 2017

@gkhanna79 Updated as suggested :)

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, thank you!

@gkhanna79 gkhanna79 merged commit 1746828 into dotnet:master May 10, 2017
@parjong parjong deleted the fix/seletive_ni_to_il_fallback branch May 10, 2017 22:10
@karelz karelz modified the milestone: 2.0.0 Aug 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants