@@ -58,14 +58,16 @@ internal static class InternalCalls
5858 // internalcalls for System.GC.
5959 //
6060
61+ private const string RuntimeLibrary = "*" ;
62+
6163 // Force a garbage collection.
6264 [ RuntimeExport ( "RhCollect" ) ]
6365 internal static void RhCollect ( int generation , InternalGCCollectionMode mode , bool lowMemoryP = false )
6466 {
6567 RhpCollect ( generation , mode , lowMemoryP ? Interop . BOOL . TRUE : Interop . BOOL . FALSE ) ;
6668 }
6769
68- [ DllImport ( Redhawk . BaseName ) ]
70+ [ DllImport ( RuntimeLibrary ) ]
6971 private static extern void RhpCollect ( int generation , InternalGCCollectionMode mode , Interop . BOOL lowMemoryP ) ;
7072
7173 [ RuntimeExport ( "RhGetGcTotalMemory" ) ]
@@ -74,7 +76,7 @@ internal static long RhGetGcTotalMemory()
7476 return RhpGetGcTotalMemory ( ) ;
7577 }
7678
77- [ DllImport ( Redhawk . BaseName ) ]
79+ [ DllImport ( RuntimeLibrary ) ]
7880 private static extern long RhpGetGcTotalMemory ( ) ;
7981
8082 [ RuntimeExport ( "RhStartNoGCRegion" ) ]
@@ -94,7 +96,7 @@ internal static int RhEndNoGCRegion()
9496 //
9597
9698 // Fetch next object which needs finalization or return null if we've reached the end of the list.
97- [ RuntimeImport ( Redhawk . BaseName , "RhpGetNextFinalizableObject" ) ]
99+ [ RuntimeImport ( RuntimeLibrary , "RhpGetNextFinalizableObject" ) ]
98100 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
99101 internal static extern object RhpGetNextFinalizableObject ( ) ;
100102
@@ -103,167 +105,167 @@ internal static int RhEndNoGCRegion()
103105 //
104106
105107 // Allocate handle.
106- [ RuntimeImport ( Redhawk . BaseName , "RhpHandleAlloc" ) ]
108+ [ RuntimeImport ( RuntimeLibrary , "RhpHandleAlloc" ) ]
107109 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
108110 internal static extern IntPtr RhpHandleAlloc ( object value , GCHandleType type ) ;
109111
110- [ RuntimeImport ( Redhawk . BaseName , "RhHandleGet" ) ]
112+ [ RuntimeImport ( RuntimeLibrary , "RhHandleGet" ) ]
111113 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
112114 internal static extern object RhHandleGet ( IntPtr handle ) ;
113115
114- [ RuntimeImport ( Redhawk . BaseName , "RhHandleSet" ) ]
116+ [ RuntimeImport ( RuntimeLibrary , "RhHandleSet" ) ]
115117 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
116118 internal static extern IntPtr RhHandleSet ( IntPtr handle , object value ) ;
117119
118120 //
119121 // internal calls for allocation
120122 //
121- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFast" ) ]
123+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFast" ) ]
122124 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
123125 internal static extern unsafe object RhpNewFast ( MethodTable * pEEType ) ; // BEWARE: not for finalizable objects!
124126
125- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFinalizable" ) ]
127+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFinalizable" ) ]
126128 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
127129 internal static extern unsafe object RhpNewFinalizable ( MethodTable * pEEType ) ;
128130
129- [ RuntimeImport ( Redhawk . BaseName , "RhpNewArray" ) ]
131+ [ RuntimeImport ( RuntimeLibrary , "RhpNewArray" ) ]
130132 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
131133 internal static extern unsafe object RhpNewArray ( MethodTable * pEEType , int length ) ;
132134
133135#if FEATURE_64BIT_ALIGNMENT
134- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFastAlign8" ) ]
136+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFastAlign8" ) ]
135137 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
136138 internal static extern unsafe object RhpNewFastAlign8 ( MethodTable * pEEType ) ; // BEWARE: not for finalizable objects!
137139
138- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFinalizableAlign8" ) ]
140+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFinalizableAlign8" ) ]
139141 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
140142 internal static extern unsafe object RhpNewFinalizableAlign8 ( MethodTable * pEEType ) ;
141143
142- [ RuntimeImport ( Redhawk . BaseName , "RhpNewArrayAlign8" ) ]
144+ [ RuntimeImport ( RuntimeLibrary , "RhpNewArrayAlign8" ) ]
143145 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
144146 internal static extern unsafe object RhpNewArrayAlign8 ( MethodTable * pEEType , int length ) ;
145147
146- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFastMisalign" ) ]
148+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFastMisalign" ) ]
147149 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
148150 internal static extern unsafe object RhpNewFastMisalign ( MethodTable * pEEType ) ;
149151#endif // FEATURE_64BIT_ALIGNMENT
150152
151- [ RuntimeImport ( Redhawk . BaseName , "RhpAssignRef" ) ]
153+ [ RuntimeImport ( RuntimeLibrary , "RhpAssignRef" ) ]
152154 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
153155 internal static extern unsafe void RhpAssignRef ( ref object ? address , object ? obj ) ;
154156
155157 [ MethodImplAttribute ( MethodImplOptions . InternalCall ) ]
156- [ RuntimeImport ( Redhawk . BaseName , "RhpGcSafeZeroMemory" ) ]
158+ [ RuntimeImport ( RuntimeLibrary , "RhpGcSafeZeroMemory" ) ]
157159 internal static extern unsafe ref byte RhpGcSafeZeroMemory ( ref byte dmem , nuint size ) ;
158160
159161 [ MethodImplAttribute ( MethodImplOptions . InternalCall ) ]
160- [ RuntimeImport ( Redhawk . BaseName , "RhBulkMoveWithWriteBarrier" ) ]
162+ [ RuntimeImport ( RuntimeLibrary , "RhBulkMoveWithWriteBarrier" ) ]
161163 internal static extern unsafe void RhBulkMoveWithWriteBarrier ( ref byte dmem , ref byte smem , nuint size ) ;
162164
163165#if FEATURE_GC_STRESS
164166 //
165167 // internal calls for GC stress
166168 //
167- [ RuntimeImport ( Redhawk . BaseName , "RhpInitializeGcStress" ) ]
169+ [ RuntimeImport ( RuntimeLibrary , "RhpInitializeGcStress" ) ]
168170 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
169171 internal static extern unsafe void RhpInitializeGcStress ( ) ;
170172#endif // FEATURE_GC_STRESS
171173
172- [ RuntimeImport ( Redhawk . BaseName , "RhpEHEnumInitFromStackFrameIterator" ) ]
174+ [ RuntimeImport ( RuntimeLibrary , "RhpEHEnumInitFromStackFrameIterator" ) ]
173175 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
174176 internal static extern unsafe bool RhpEHEnumInitFromStackFrameIterator ( ref StackFrameIterator pFrameIter , out EH . MethodRegionInfo pMethodRegionInfo , void * pEHEnum ) ;
175177
176- [ RuntimeImport ( Redhawk . BaseName , "RhpEHEnumNext" ) ]
178+ [ RuntimeImport ( RuntimeLibrary , "RhpEHEnumNext" ) ]
177179 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
178180 internal static extern unsafe bool RhpEHEnumNext ( void * pEHEnum , void * pEHClause ) ;
179181
180- [ RuntimeImport ( Redhawk . BaseName , "RhpGetDispatchCellInfo" ) ]
182+ [ RuntimeImport ( RuntimeLibrary , "RhpGetDispatchCellInfo" ) ]
181183 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
182184 internal static extern unsafe void RhpGetDispatchCellInfo ( IntPtr pCell , out DispatchCellInfo newCellInfo ) ;
183185
184- [ RuntimeImport ( Redhawk . BaseName , "RhpSearchDispatchCellCache" ) ]
186+ [ RuntimeImport ( RuntimeLibrary , "RhpSearchDispatchCellCache" ) ]
185187 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
186188 internal static extern unsafe IntPtr RhpSearchDispatchCellCache ( IntPtr pCell , MethodTable * pInstanceType ) ;
187189
188- [ RuntimeImport ( Redhawk . BaseName , "RhpUpdateDispatchCellCache" ) ]
190+ [ RuntimeImport ( RuntimeLibrary , "RhpUpdateDispatchCellCache" ) ]
189191 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
190192 internal static extern unsafe IntPtr RhpUpdateDispatchCellCache ( IntPtr pCell , IntPtr pTargetCode , MethodTable * pInstanceType , ref DispatchCellInfo newCellInfo ) ;
191193
192- [ RuntimeImport ( Redhawk . BaseName , "RhpGetClasslibFunctionFromCodeAddress" ) ]
194+ [ RuntimeImport ( RuntimeLibrary , "RhpGetClasslibFunctionFromCodeAddress" ) ]
193195 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
194196 internal static extern unsafe void * RhpGetClasslibFunctionFromCodeAddress ( IntPtr address , ClassLibFunctionId id ) ;
195197
196- [ RuntimeImport ( Redhawk . BaseName , "RhpGetClasslibFunctionFromEEType" ) ]
198+ [ RuntimeImport ( RuntimeLibrary , "RhpGetClasslibFunctionFromEEType" ) ]
197199 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
198200 internal static extern unsafe void * RhpGetClasslibFunctionFromEEType ( MethodTable * pEEType , ClassLibFunctionId id ) ;
199201
200202 //
201203 // StackFrameIterator
202204 //
203205
204- [ RuntimeImport ( Redhawk . BaseName , "RhpSfiInit" ) ]
206+ [ RuntimeImport ( RuntimeLibrary , "RhpSfiInit" ) ]
205207 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
206208 internal static extern unsafe bool RhpSfiInit ( ref StackFrameIterator pThis , void * pStackwalkCtx , bool instructionFault , bool * fIsExceptionIntercepted ) ;
207209
208- [ RuntimeImport ( Redhawk . BaseName , "RhpSfiNext" ) ]
210+ [ RuntimeImport ( RuntimeLibrary , "RhpSfiNext" ) ]
209211 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
210212 internal static extern unsafe bool RhpSfiNext ( ref StackFrameIterator pThis , uint * uExCollideClauseIdx , bool * fUnwoundReversePInvoke , bool * fIsExceptionIntercepted ) ;
211213
212214 //
213215 // Miscellaneous helpers.
214216 //
215217
216- [ RuntimeImport ( Redhawk . BaseName , "RhpCallCatchFunclet" ) ]
218+ [ RuntimeImport ( RuntimeLibrary , "RhpCallCatchFunclet" ) ]
217219 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
218220 internal static extern unsafe IntPtr RhpCallCatchFunclet (
219221 object exceptionObj , byte * pHandlerIP , void * pvRegDisplay , ref EH . ExInfo exInfo ) ;
220222
221- [ RuntimeImport ( Redhawk . BaseName , "RhpCallFinallyFunclet" ) ]
223+ [ RuntimeImport ( RuntimeLibrary , "RhpCallFinallyFunclet" ) ]
222224 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
223225 internal static extern unsafe void RhpCallFinallyFunclet ( byte * pHandlerIP , void * pvRegDisplay ) ;
224226
225- [ RuntimeImport ( Redhawk . BaseName , "RhpCallFilterFunclet" ) ]
227+ [ RuntimeImport ( RuntimeLibrary , "RhpCallFilterFunclet" ) ]
226228 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
227229 internal static extern unsafe bool RhpCallFilterFunclet (
228230 object exceptionObj , byte * pFilterIP , void * pvRegDisplay ) ;
229231
230232#if FEATURE_OBJCMARSHAL
231- [ RuntimeImport ( Redhawk . BaseName , "RhpCallPropagateExceptionCallback" ) ]
233+ [ RuntimeImport ( RuntimeLibrary , "RhpCallPropagateExceptionCallback" ) ]
232234 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
233235 internal static extern unsafe IntPtr RhpCallPropagateExceptionCallback (
234236 IntPtr callbackContext , IntPtr callback , void * pvRegDisplay , ref EH . ExInfo exInfo , IntPtr pPreviousTransitionFrame ) ;
235237#endif // FEATURE_OBJCMARSHAL
236238
237- [ RuntimeImport ( Redhawk . BaseName , "RhpFallbackFailFast" ) ]
239+ [ RuntimeImport ( RuntimeLibrary , "RhpFallbackFailFast" ) ]
238240 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
239241 internal static extern unsafe void RhpFallbackFailFast ( ) ;
240242
241- [ RuntimeImport ( Redhawk . BaseName , "RhpSetThreadDoNotTriggerGC" ) ]
243+ [ RuntimeImport ( RuntimeLibrary , "RhpSetThreadDoNotTriggerGC" ) ]
242244 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
243245 internal static extern void RhpSetThreadDoNotTriggerGC ( ) ;
244246
245247 [ System . Diagnostics . Conditional ( "DEBUG" ) ]
246- [ RuntimeImport ( Redhawk . BaseName , "RhpValidateExInfoStack" ) ]
248+ [ RuntimeImport ( RuntimeLibrary , "RhpValidateExInfoStack" ) ]
247249 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
248250 internal static extern void RhpValidateExInfoStack ( ) ;
249251
250252#if TARGET_WINDOWS
251- [ RuntimeImport ( Redhawk . BaseName , "RhpFirstChanceExceptionNotification" ) ]
253+ [ RuntimeImport ( RuntimeLibrary , "RhpFirstChanceExceptionNotification" ) ]
252254 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
253255 internal static extern void RhpFirstChanceExceptionNotification ( ) ;
254256#endif
255257
256258#if TARGET_WINDOWS
257- [ RuntimeImport ( Redhawk . BaseName , "RhpCopyContextFromExInfo" ) ]
259+ [ RuntimeImport ( RuntimeLibrary , "RhpCopyContextFromExInfo" ) ]
258260 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
259261 internal static extern unsafe void RhpCopyContextFromExInfo ( void * pOSContext , int cbOSContext , EH . PAL_LIMITED_CONTEXT * pPalContext ) ;
260262#endif
261263
262- [ RuntimeImport ( Redhawk . BaseName , "RhpGetThreadAbortException" ) ]
264+ [ RuntimeImport ( RuntimeLibrary , "RhpGetThreadAbortException" ) ]
263265 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
264266 internal static extern Exception RhpGetThreadAbortException ( ) ;
265267
266- [ RuntimeImport ( Redhawk . BaseName , "RhCurrentNativeThreadId" ) ]
268+ [ RuntimeImport ( RuntimeLibrary , "RhCurrentNativeThreadId" ) ]
267269 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
268270 internal static extern unsafe IntPtr RhCurrentNativeThreadId ( ) ;
269271
@@ -279,21 +281,21 @@ internal static extern unsafe IntPtr RhpCallPropagateExceptionCallback(
279281
280282 // Block the current thread until at least one object needs to be finalized (returns true) or
281283 // memory is low (returns false and the finalizer thread should initiate a garbage collection).
282- [ DllImport ( Redhawk . BaseName ) ]
284+ [ DllImport ( RuntimeLibrary ) ]
283285 internal static extern uint RhpWaitForFinalizerRequest ( ) ;
284286
285287 // Indicate that the current round of finalizations is complete.
286- [ DllImport ( Redhawk . BaseName ) ]
288+ [ DllImport ( RuntimeLibrary ) ]
287289 internal static extern void RhpSignalFinalizationComplete ( uint fCount , int observedFullGcCount ) ;
288290
289291 // Enters a no GC region, possibly doing a blocking GC if there is not enough
290292 // memory available to satisfy the caller's request.
291- [ DllImport ( Redhawk . BaseName ) ]
293+ [ DllImport ( RuntimeLibrary ) ]
292294 internal static extern int RhpStartNoGCRegion ( long totalSize , Interop . BOOL hasLohSize , long lohSize , Interop . BOOL disallowFullBlockingGC ) ;
293295
294296 // Exits a no GC region, possibly doing a GC to clean up the garbage that
295297 // the caller allocated.
296- [ DllImport ( Redhawk . BaseName ) ]
298+ [ DllImport ( RuntimeLibrary ) ]
297299 internal static extern int RhpEndNoGCRegion ( ) ;
298300 }
299301}
0 commit comments