Fix Issue dotnet/coreclr#10022. (dotnet/coreclr#10587)
This issue occurred because the JIT currently inserts the P/Invoke
method prolog into the first block of a function without ensuring that
this block will only execute once. This is not safe, as executing the
P/Invoke prolog multiple times can create cycles in the frame list and
casue the stack unwinder to hang.
This change ensures that lowering inserts a new, single-entry basic
block at the beginning of the function for functions that require P/Invoke prologs.
Commit migrated from https://github.com/dotnet/coreclr/commit/
9b342387cd8e75249609d30ab79f05193f714e80