Skip to content

String literal mangling fix - #1

Closed
A-And wants to merge 38 commits into
masterfrom
StringLoadFix
Closed

A-And wants to merge 38 commits into
masterfrom
StringLoadFix

Conversation

@A-And

@A-And A-And commented Aug 25, 2016 •

Copy link
Copy Markdown
Owner

No description provided.

jkotas and others added 30 commits August 23, 2016 06:26
This was a helper function meant to ease
the transition over to unified Type/TypeInfo's.
Now it's purpose has been served.
Get rid CastToType() helper in Reflection.Core
SG tool is not able to deal with duplicate SerializationException definition in CoreLib. Remote it for now until it is fixed.

[tfs-changeset: 1623722]
CR: JKotas

SemaphoreSlim and ConcurrentUnifier variations called Lock.Acquire directly, but then used Monitor.IsEntered to check whether the lock is held.  Fix the code to use Lock.IsAcquired instead of  Monitor.IsEntered.  Also remove dead copies of ConcurrentUnifier* files.

[tfs-changeset: 1623728]
Avoid unnecessary allocations in TextInfo.ChangeCase on Windows:

- ChangeCase(char, bool) allocates a temporary string from the source
char. Instead, pass the address of the source char to avoid the
intermediate string allocation.

- ChangeCase(string, bool) allocates a temporary char[] buffer, then
creates a new string from that buffer. Instead, use
string.FastAllocateString to avoid the intermediate buffer
allocation, which aligns with the Unix implementation in CoreCLR.
I'll leave the interop and constraint validator work
to their respective owners. It's low-pri work and
I don't want to keep guessing the correct behavior
there.
Wean Reflection.Core off the Extensibility types.
Remove CORERT ifdef around Math.Abs implementation and made the behavior match other .NET implementations

Fixes bug #247525

[tfs-changeset: 1623767]
An unnecessary intermediate char[] allocation can be avoided by calling
`new string(c, 1)` instead of `new string(new char[] { c })`.
Now we just have to make them work...
Finished Reflection surface area in N Corelib.
System\Threading\Tasks\DebugHelperRooter.cs was workaround for a bug that was fixed long time ago. Also fixed casing for future.cs while I was on it.

[tfs-changeset: 1623785]
CR: JKotas, SergeyK

*  Mark the SyncTable class with [EagerStaticClassConstruction] to avoid static constructor checks.  Construction ordering should be unimportant since we do not use Monitor.Enter during runtime initialization.
*  Remove the type check for the Lock type from Monitor.Enter code path.  The Lock type is internal and internal code must use Lock.Acquire instead.  Add a debug assert verifying the object is not of the Lock type.
*  Put the AggressiveInlining attribute on two performance-critical functions, which NUTC does not inline.  At least GetSyncEntryIndex is expected to be inlined; reported this issue to the NUTC team.
*  In ObjectHeader.GetSyncEntryIndex use a bit shift trick to save one of two branches.

With these changes uncontended lock performance in ProjectN becomes around 92% of CLR thick lock performance and 82% of CLR thin lock performance (assuming no cache misses for thick locks).

[tfs-changeset: 1623787]
Add section on how to file security bugs
…f available.

SGen will try to find types by simply looking for it in all of the loaded assemblies. This fails if we find the type twice (basically a bug in the FX, but those happen). This change modifies this code to try CCI as the last chance. We try to find a type forwarder for the affected type. If we do find it, we simply follow it, since that will pick the right assembly (and thus the right version of the type).

Also revert the hack to work around the issue which is now fixed.

[tfs-changeset: 1623908]
These apis on System.Type are now functional.

    GetConstructors()
    GetEvents()
    GetFields()
    GetMembers()
    GetMethods()
    GetNestedTypes()
    GetProperties()

    GetConstructors(BindingFlags bindingAttr);
    GetEvents(BindingFlags bindingAttr);
    GetFields(BindingFlags bindingAttr);
    GetMembers(BindingFlags bindingAttr);
    GetMethods(BindingFlags bindingAttr);
    GetNestedTypes(BindingFlags bindingAttr);
    GetProperties(BindingFlags bindingAttr);

    GetEvent(string name);
    GetField(string name);
    GetMember(string name);
    GetMethod(string name);
    GetNestedType(string name);
    GetProperty(string name);

    GetEvent(string name, BindingFlags bindingAttr);
    GetField(string name, BindingFlags bindingAttr);
    GetMember(string name, BindingFlags bindingAttr);
    GetMethod(string name, BindingFlags bindingAttr);
    GetNestedType(string name, BindingFlags bindingAttr);
    GetProperty(string name, BindingFlags bindingAttr);

This was brought up by embedding a cut down version
of System.Reflection.TypeExtensions inside Reflection.Core.

These aren't the final implementations as there's perf
work to do, but these apis are used everywhere
(and assemblies that switch to the new contracts will
be rediverted to them whether want to be or not)
so we need to get them up and running to keep things
flowing.
Initial bringup for Type.GetX() members.
Use handleMultiplier in JitInterface ObjectToHandle instead of a literal
value to match the implementation of HandleToObject incase we ever make
the multiplier architecture specific.
Gee, I don't think we have enough apis to do this - should
we propose a few more?

Anyhow, this was done by moving the CustomAttributeExtensions
class from System.Reflection.Extensions.dll into Corelib.

We also needed to move CustomAttributeInstantiator
from S.P.R.Execution to Corelib (with a typeforwarder.)

Though CustomAttributeExtensions is supposed to be the
"bandaid" api, it actually has the nicest apis so now
it gets to be near the bottom of the stack (with
XInfo.CustomAttributes being the lowest-level primitive.)

Everything else is legacy api that we threw out in
.Net Core.
atsushikan and others added 8 commits August 24, 2016 15:50
Bring up the apis to retrieve custom attributes.
…ith the rest of the .Net Native toolchain.

[tfs-changeset: 1624133]
Port dotnet/coreclr#6907 from CoreCLR.

Remove EncodingCache and cache UTF32BE in a static field.
Double quotes were not getting escaped and causing CPP codegen to crash
@A-And
A-And changed the base branch from CPP-Code-Gen-Merged to master August 25, 2016 22:31
@A-And A-And closed this Aug 25, 2016
A-And pushed a commit that referenced this pull request Oct 3, 2018
The ProjectN compiler never finishes compiling an app from an external use. The issue turns out to be due to the debug recording generation for a huge generic expansion. There are actually two problems:

1. The generic complexity computation is improper for the huge generic expansion in the failing case. The complexity computed was 0 and the compiler didn’t know it’s huge.

2. We are missing the check against the generic complexity in some places where UDT debug records are prepared.

Fixing #1 at this point is tricky since it may cause wide asm diffs where normal calls become USG calls.

Fixing #2 means the UDT types in the debug$T section for huge generic instantiations will fall back to USG or canonical records, so will the debug$S records for associated static fields. The debug$T change should only affect native debugging. The debug$S change can affect managed debugging but only for huge generic instantiations.

We've decided #2 is probably the less risky way to unblock the user in the next release and it's fixed by this change for both ProjectN and ProjectX.

[tfs-changeset: 1711506]
A-And pushed a commit that referenced this pull request Oct 3, 2018
* Fix ServiceController name population perf

* Split tests

* Remove dead field

* Remove new use of DangerousGetHandle

* SafeHandle all the things!

* VSB #1

* VSB #2

* Fix GLE

* Initialize machineName in ctor

* Test for empty name ex

* Null names

* Inadvertent edit

* Unix build

* Move interop into class

* Reverse SafeHandle for HAllocGlobal

* Fix tests

* Disable test for NETFX

* CR feedback

* Pattern matching on VSB

* Direct call

* typo

Signed-off-by: dotnet-bot <[email protected]>
A-And pushed a commit that referenced this pull request Nov 12, 2018
* CorInfoImpl refactoring part #1

1) Refactor ComputeLookup to pass around references to the
CORINFO_RESOLVED_TOKEN instead of its tokenContext. This will be
needed in the next change to implement R2R variants of the methods.

2) Add new CanInline method to the Compilation class to be used
by CorInfoImpl to query inline-ability.

Thanks

Tomas

* Remove superfluous "using Internal.JitInterface" from CorInfoImpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants