Skip to content

Commit bbd813b

Browse files
committed
Fix build
Include classes that are part of the Java Marshal API on mono as well Disable test on mono and nativeaot.
1 parent 29074d4 commit bbd813b

File tree

8 files changed

+19
-27
lines changed

8 files changed

+19
-27
lines changed

src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/GCHandle.CoreCLR.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private static void InternalFreeWithGCTransition(IntPtr dependentHandle)
4646
internal static extern bool InternalTryGetBridgeWait(IntPtr handle, ref object? result);
4747

4848
[LibraryImport(RuntimeHelpers.QCall, EntryPoint = "GCHandle_InternalGetBridgeWait")]
49-
internal static partial void InternalGetBridgeWait(IntPtr handle, ObjectHandleOnStack result);
49+
private static partial void InternalGetBridgeWait(IntPtr handle, ObjectHandleOnStack result);
5050

5151
internal static void InternalGetBridgeWait(IntPtr handle, ref object? result)
5252
{

src/coreclr/gc/gc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30479,7 +30479,7 @@ void gc_heap::mark_phase (int condemned_gen_number)
3047930479
size_t start_index = thread * count_per_heap;
3048030480
size_t end_index = (thread == n_heaps - 1) ? num_global_bridge_objs : (thread + 1) * count_per_heap;
3048130481

30482-
for (int obj_idx = start_index; obj_idx < end_index; obj_idx++)
30482+
for (size_t obj_idx = start_index; obj_idx < end_index; obj_idx++)
3048330483
{
3048430484
mark_object_simple (&global_bridge_list[obj_idx] THREAD_NUMBER_ARG);
3048530485
}
@@ -39247,7 +39247,7 @@ void gc_heap::background_mark_phase ()
3924739247
size_t start_index = thread * count_per_heap;
3924839248
size_t end_index = (thread == n_heaps - 1) ? num_global_bridge_objs : (thread + 1) * count_per_heap;
3924939249

39250-
for (int obj_idx = start_index; obj_idx < end_index; obj_idx++)
39250+
for (size_t obj_idx = start_index; obj_idx < end_index; obj_idx++)
3925139251
{
3925239252
mark_object_simple (&global_bridge_list[obj_idx] THREAD_NUMBER_ARG);
3925339253
}

src/coreclr/gc/gcbridge.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ static ColorData* alloc_color_data ()
399399
static void empty_color_buckets ()
400400
{
401401
ColorBucket* cur;
402-
ColorBucket* tmp;
403402

404403
color_data_count = 0;
405404

@@ -627,7 +626,8 @@ static void add_other_colors (ColorData* color, DynPtrArray* other_colors, bool
627626
}
628627
dyn_ptr_array_add(&color->other_colors, points_to);
629628
// Inform targets
630-
points_to->incoming_colors = min(points_to->incoming_colors + 1, INCOMING_COLORS_MAX);
629+
if (points_to->incoming_colors < INCOMING_COLORS_MAX)
630+
points_to->incoming_colors++;
631631
}
632632
}
633633

@@ -1287,9 +1287,6 @@ static void build_scc_callback_data (BridgeProcessorResult *bp_res)
12871287

12881288
BridgeProcessorResult ProcessBridgeObjects()
12891289
{
1290-
int i;
1291-
uint64_t curtime;
1292-
12931290
BridgeProcessorResult bp_res = { 0 };
12941291

12951292
if (!tarjan_scc_algorithm())

src/coreclr/gc/objecthandle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ uint8_t** Ref_ScanBridgeObjects(uint32_t condemned, uint32_t maxgen, ScanContext
16171617
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[uCPUindex];
16181618
if (hTable)
16191619
// or have a local var for bridgeObjectsToPromote/size (instead of NULL) that's passed in as lp2
1620-
HndScanHandlesForGC(hTable, GetBridgeObjectsForProcessing, uintptr_t(sc), NULL, &type, 1, condemned, maxgen, HNDGCF_EXTRAINFO | flags);
1620+
HndScanHandlesForGC(hTable, GetBridgeObjectsForProcessing, uintptr_t(sc), 0, &type, 1, condemned, maxgen, HNDGCF_EXTRAINFO | flags);
16211621
}
16221622
}
16231623
walk = walk->pNext;

src/coreclr/vm/interoplibinterface_shared.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void Interop::OnAfterGCScanRoots(_In_ bool isConcurrent)
159159

160160
namespace
161161
{
162-
Volatile<BOOL> g_GCBridgeActive = FALSE;
162+
Volatile<bool> g_GCBridgeActive = false;
163163
CLREvent* g_bridgeFinished = nullptr;
164164

165165
void ReleaseGCBridgeArgumentsWorker(
@@ -189,11 +189,7 @@ namespace
189189

190190
bool Interop::IsGCBridgeActive()
191191
{
192-
CONTRACTL
193-
{
194-
MODE_COOPERATIVE;
195-
}
196-
CONTRACTL_END;
192+
LIMITED_METHOD_CONTRACT;
197193

198194
return g_GCBridgeActive;
199195
}
@@ -237,7 +233,7 @@ void Interop::TriggerClientBridgeProcessing(
237233
return;
238234
}
239235

240-
bool gcBridgeTriggered;
236+
bool gcBridgeTriggered = false;
241237

242238
#ifdef FEATURE_JAVAMARSHAL
243239
gcBridgeTriggered = JavaNative::TriggerClientBridgeProcessing(sccsLen, sccs, ccrsLen, ccrs);

src/coreclr/vm/marshalnative.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
#ifdef FEATURE_GCBRIDGE
4848
#include "interoplibinterface.h"
49-
#endif
49+
#endif // FEATURE_GCBRIDGE
5050

5151
// Prelink
5252
// Does advance loading of an N/Direct library
@@ -440,7 +440,7 @@ extern "C" void QCALLTYPE GCHandle_InternalGetBridgeWait(OBJECTHANDLE handle, QC
440440

441441
END_QCALL;
442442
}
443-
#endif
443+
#endif // FEATURE_GCBRIDGE
444444

445445
// Update the object referenced by a GC handle.
446446
FCIMPL2(VOID, MarshalNative::GCHandleInternalSet, OBJECTHANDLE handle, Object *obj)

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,10 @@
993993
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\InterfaceTypeAttribute.cs" />
994994
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\InvalidComObjectException.cs" />
995995
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\InvalidOleVariantTypeException.cs" />
996+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\Java\ComponentCrossReference.cs" />
997+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\Java\JavaMarshal.cs" />
998+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\Java\MarkCrossReferencesArgs.cs" />
999+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\Java\StronglyConnectedComponent.cs" />
9961000
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\LayoutKind.cs" />
9971001
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\LCIDConversionAttribute.cs" />
9981002
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\LibraryImportAttribute.cs" />
@@ -2802,12 +2806,6 @@
28022806
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ObjectiveC\ObjectiveCMarshal.PlatformNotSupported.cs" />
28032807
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ObjectiveC\ObjectiveCTrackedTypeAttribute.cs" />
28042808
</ItemGroup>
2805-
<ItemGroup Condition="'$(FeatureJavaMarshal)' == 'true'">
2806-
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\Java\ComponentCrossReference.cs" />
2807-
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\Java\JavaMarshal.cs" />
2808-
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\Java\MarkCrossReferencesArgs.cs" />
2809-
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\Java\StronglyConnectedComponent.cs" />
2810-
</ItemGroup>
28112809
<ItemGroup Condition="'$(FeatureCoreCLR)' != 'true' and ('$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true')">
28122810
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeWaitHandle.Unix.cs" />
28132811
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\EventWaitHandle.Unix.cs" />
@@ -2865,4 +2863,4 @@
28652863
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Wasi\WasiPollWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs" />
28662864
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Wasi\WasiPollWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs" />
28672865
</ItemGroup>
2868-
</Project>
2866+
</Project>

src/tests/Interop/GCBridge/BridgeTest.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<PropertyGroup>
33
<!-- Needed for CLRTestTargetUnsupported, CMakeProjectReference, GC.WaitForPendingFinalizers -->
44
<RequiresProcessIsolation>true</RequiresProcessIsolation>
5-
<!-- Test unsupported outside of OSX -->
6-
<CLRTestTargetUnsupported Condition="'$(TargetsUnix)' != 'true'">true</CLRTestTargetUnsupported>
5+
<DisableProjectBuild Condition="'$(RuntimeFlavor)' == 'Mono'">true</DisableProjectBuild>
6+
<!-- Support for native aot not yet implemented -->
7+
<NativeAotIncompatible>true</NativeAotIncompatible>
78
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
89
</PropertyGroup>
910
<ItemGroup>

0 commit comments

Comments
 (0)