@@ -58,14 +58,16 @@ internal static class InternalCalls
58
58
// internalcalls for System.GC.
59
59
//
60
60
61
+ private const string RuntimeLibrary = "*" ;
62
+
61
63
// Force a garbage collection.
62
64
[ RuntimeExport ( "RhCollect" ) ]
63
65
internal static void RhCollect ( int generation , InternalGCCollectionMode mode , bool lowMemoryP = false )
64
66
{
65
67
RhpCollect ( generation , mode , lowMemoryP ? Interop . BOOL . TRUE : Interop . BOOL . FALSE ) ;
66
68
}
67
69
68
- [ DllImport ( Redhawk . BaseName ) ]
70
+ [ DllImport ( RuntimeLibrary ) ]
69
71
private static extern void RhpCollect ( int generation , InternalGCCollectionMode mode , Interop . BOOL lowMemoryP ) ;
70
72
71
73
[ RuntimeExport ( "RhGetGcTotalMemory" ) ]
@@ -74,7 +76,7 @@ internal static long RhGetGcTotalMemory()
74
76
return RhpGetGcTotalMemory ( ) ;
75
77
}
76
78
77
- [ DllImport ( Redhawk . BaseName ) ]
79
+ [ DllImport ( RuntimeLibrary ) ]
78
80
private static extern long RhpGetGcTotalMemory ( ) ;
79
81
80
82
[ RuntimeExport ( "RhStartNoGCRegion" ) ]
@@ -94,7 +96,7 @@ internal static int RhEndNoGCRegion()
94
96
//
95
97
96
98
// 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" ) ]
98
100
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
99
101
internal static extern object RhpGetNextFinalizableObject ( ) ;
100
102
@@ -103,167 +105,167 @@ internal static int RhEndNoGCRegion()
103
105
//
104
106
105
107
// Allocate handle.
106
- [ RuntimeImport ( Redhawk . BaseName , "RhpHandleAlloc" ) ]
108
+ [ RuntimeImport ( RuntimeLibrary , "RhpHandleAlloc" ) ]
107
109
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
108
110
internal static extern IntPtr RhpHandleAlloc ( object value , GCHandleType type ) ;
109
111
110
- [ RuntimeImport ( Redhawk . BaseName , "RhHandleGet" ) ]
112
+ [ RuntimeImport ( RuntimeLibrary , "RhHandleGet" ) ]
111
113
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
112
114
internal static extern object RhHandleGet ( IntPtr handle ) ;
113
115
114
- [ RuntimeImport ( Redhawk . BaseName , "RhHandleSet" ) ]
116
+ [ RuntimeImport ( RuntimeLibrary , "RhHandleSet" ) ]
115
117
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
116
118
internal static extern IntPtr RhHandleSet ( IntPtr handle , object value ) ;
117
119
118
120
//
119
121
// internal calls for allocation
120
122
//
121
- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFast" ) ]
123
+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFast" ) ]
122
124
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
123
125
internal static extern unsafe object RhpNewFast ( MethodTable * pEEType ) ; // BEWARE: not for finalizable objects!
124
126
125
- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFinalizable" ) ]
127
+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFinalizable" ) ]
126
128
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
127
129
internal static extern unsafe object RhpNewFinalizable ( MethodTable * pEEType ) ;
128
130
129
- [ RuntimeImport ( Redhawk . BaseName , "RhpNewArray" ) ]
131
+ [ RuntimeImport ( RuntimeLibrary , "RhpNewArray" ) ]
130
132
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
131
133
internal static extern unsafe object RhpNewArray ( MethodTable * pEEType , int length ) ;
132
134
133
135
#if FEATURE_64BIT_ALIGNMENT
134
- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFastAlign8" ) ]
136
+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFastAlign8" ) ]
135
137
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
136
138
internal static extern unsafe object RhpNewFastAlign8 ( MethodTable * pEEType ) ; // BEWARE: not for finalizable objects!
137
139
138
- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFinalizableAlign8" ) ]
140
+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFinalizableAlign8" ) ]
139
141
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
140
142
internal static extern unsafe object RhpNewFinalizableAlign8 ( MethodTable * pEEType ) ;
141
143
142
- [ RuntimeImport ( Redhawk . BaseName , "RhpNewArrayAlign8" ) ]
144
+ [ RuntimeImport ( RuntimeLibrary , "RhpNewArrayAlign8" ) ]
143
145
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
144
146
internal static extern unsafe object RhpNewArrayAlign8 ( MethodTable * pEEType , int length ) ;
145
147
146
- [ RuntimeImport ( Redhawk . BaseName , "RhpNewFastMisalign" ) ]
148
+ [ RuntimeImport ( RuntimeLibrary , "RhpNewFastMisalign" ) ]
147
149
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
148
150
internal static extern unsafe object RhpNewFastMisalign ( MethodTable * pEEType ) ;
149
151
#endif // FEATURE_64BIT_ALIGNMENT
150
152
151
- [ RuntimeImport ( Redhawk . BaseName , "RhpAssignRef" ) ]
153
+ [ RuntimeImport ( RuntimeLibrary , "RhpAssignRef" ) ]
152
154
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
153
155
internal static extern unsafe void RhpAssignRef ( ref object ? address , object ? obj ) ;
154
156
155
157
[ MethodImplAttribute ( MethodImplOptions . InternalCall ) ]
156
- [ RuntimeImport ( Redhawk . BaseName , "RhpGcSafeZeroMemory" ) ]
158
+ [ RuntimeImport ( RuntimeLibrary , "RhpGcSafeZeroMemory" ) ]
157
159
internal static extern unsafe ref byte RhpGcSafeZeroMemory ( ref byte dmem , nuint size ) ;
158
160
159
161
[ MethodImplAttribute ( MethodImplOptions . InternalCall ) ]
160
- [ RuntimeImport ( Redhawk . BaseName , "RhBulkMoveWithWriteBarrier" ) ]
162
+ [ RuntimeImport ( RuntimeLibrary , "RhBulkMoveWithWriteBarrier" ) ]
161
163
internal static extern unsafe void RhBulkMoveWithWriteBarrier ( ref byte dmem , ref byte smem , nuint size ) ;
162
164
163
165
#if FEATURE_GC_STRESS
164
166
//
165
167
// internal calls for GC stress
166
168
//
167
- [ RuntimeImport ( Redhawk . BaseName , "RhpInitializeGcStress" ) ]
169
+ [ RuntimeImport ( RuntimeLibrary , "RhpInitializeGcStress" ) ]
168
170
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
169
171
internal static extern unsafe void RhpInitializeGcStress ( ) ;
170
172
#endif // FEATURE_GC_STRESS
171
173
172
- [ RuntimeImport ( Redhawk . BaseName , "RhpEHEnumInitFromStackFrameIterator" ) ]
174
+ [ RuntimeImport ( RuntimeLibrary , "RhpEHEnumInitFromStackFrameIterator" ) ]
173
175
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
174
176
internal static extern unsafe bool RhpEHEnumInitFromStackFrameIterator ( ref StackFrameIterator pFrameIter , out EH . MethodRegionInfo pMethodRegionInfo , void * pEHEnum ) ;
175
177
176
- [ RuntimeImport ( Redhawk . BaseName , "RhpEHEnumNext" ) ]
178
+ [ RuntimeImport ( RuntimeLibrary , "RhpEHEnumNext" ) ]
177
179
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
178
180
internal static extern unsafe bool RhpEHEnumNext ( void * pEHEnum , void * pEHClause ) ;
179
181
180
- [ RuntimeImport ( Redhawk . BaseName , "RhpGetDispatchCellInfo" ) ]
182
+ [ RuntimeImport ( RuntimeLibrary , "RhpGetDispatchCellInfo" ) ]
181
183
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
182
184
internal static extern unsafe void RhpGetDispatchCellInfo ( IntPtr pCell , out DispatchCellInfo newCellInfo ) ;
183
185
184
- [ RuntimeImport ( Redhawk . BaseName , "RhpSearchDispatchCellCache" ) ]
186
+ [ RuntimeImport ( RuntimeLibrary , "RhpSearchDispatchCellCache" ) ]
185
187
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
186
188
internal static extern unsafe IntPtr RhpSearchDispatchCellCache ( IntPtr pCell , MethodTable * pInstanceType ) ;
187
189
188
- [ RuntimeImport ( Redhawk . BaseName , "RhpUpdateDispatchCellCache" ) ]
190
+ [ RuntimeImport ( RuntimeLibrary , "RhpUpdateDispatchCellCache" ) ]
189
191
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
190
192
internal static extern unsafe IntPtr RhpUpdateDispatchCellCache ( IntPtr pCell , IntPtr pTargetCode , MethodTable * pInstanceType , ref DispatchCellInfo newCellInfo ) ;
191
193
192
- [ RuntimeImport ( Redhawk . BaseName , "RhpGetClasslibFunctionFromCodeAddress" ) ]
194
+ [ RuntimeImport ( RuntimeLibrary , "RhpGetClasslibFunctionFromCodeAddress" ) ]
193
195
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
194
196
internal static extern unsafe void * RhpGetClasslibFunctionFromCodeAddress ( IntPtr address , ClassLibFunctionId id ) ;
195
197
196
- [ RuntimeImport ( Redhawk . BaseName , "RhpGetClasslibFunctionFromEEType" ) ]
198
+ [ RuntimeImport ( RuntimeLibrary , "RhpGetClasslibFunctionFromEEType" ) ]
197
199
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
198
200
internal static extern unsafe void * RhpGetClasslibFunctionFromEEType ( MethodTable * pEEType , ClassLibFunctionId id ) ;
199
201
200
202
//
201
203
// StackFrameIterator
202
204
//
203
205
204
- [ RuntimeImport ( Redhawk . BaseName , "RhpSfiInit" ) ]
206
+ [ RuntimeImport ( RuntimeLibrary , "RhpSfiInit" ) ]
205
207
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
206
208
internal static extern unsafe bool RhpSfiInit ( ref StackFrameIterator pThis , void * pStackwalkCtx , bool instructionFault , bool * fIsExceptionIntercepted ) ;
207
209
208
- [ RuntimeImport ( Redhawk . BaseName , "RhpSfiNext" ) ]
210
+ [ RuntimeImport ( RuntimeLibrary , "RhpSfiNext" ) ]
209
211
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
210
212
internal static extern unsafe bool RhpSfiNext ( ref StackFrameIterator pThis , uint * uExCollideClauseIdx , bool * fUnwoundReversePInvoke , bool * fIsExceptionIntercepted ) ;
211
213
212
214
//
213
215
// Miscellaneous helpers.
214
216
//
215
217
216
- [ RuntimeImport ( Redhawk . BaseName , "RhpCallCatchFunclet" ) ]
218
+ [ RuntimeImport ( RuntimeLibrary , "RhpCallCatchFunclet" ) ]
217
219
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
218
220
internal static extern unsafe IntPtr RhpCallCatchFunclet (
219
221
object exceptionObj , byte * pHandlerIP , void * pvRegDisplay , ref EH . ExInfo exInfo ) ;
220
222
221
- [ RuntimeImport ( Redhawk . BaseName , "RhpCallFinallyFunclet" ) ]
223
+ [ RuntimeImport ( RuntimeLibrary , "RhpCallFinallyFunclet" ) ]
222
224
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
223
225
internal static extern unsafe void RhpCallFinallyFunclet ( byte * pHandlerIP , void * pvRegDisplay ) ;
224
226
225
- [ RuntimeImport ( Redhawk . BaseName , "RhpCallFilterFunclet" ) ]
227
+ [ RuntimeImport ( RuntimeLibrary , "RhpCallFilterFunclet" ) ]
226
228
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
227
229
internal static extern unsafe bool RhpCallFilterFunclet (
228
230
object exceptionObj , byte * pFilterIP , void * pvRegDisplay ) ;
229
231
230
232
#if FEATURE_OBJCMARSHAL
231
- [ RuntimeImport ( Redhawk . BaseName , "RhpCallPropagateExceptionCallback" ) ]
233
+ [ RuntimeImport ( RuntimeLibrary , "RhpCallPropagateExceptionCallback" ) ]
232
234
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
233
235
internal static extern unsafe IntPtr RhpCallPropagateExceptionCallback (
234
236
IntPtr callbackContext , IntPtr callback , void * pvRegDisplay , ref EH . ExInfo exInfo , IntPtr pPreviousTransitionFrame ) ;
235
237
#endif // FEATURE_OBJCMARSHAL
236
238
237
- [ RuntimeImport ( Redhawk . BaseName , "RhpFallbackFailFast" ) ]
239
+ [ RuntimeImport ( RuntimeLibrary , "RhpFallbackFailFast" ) ]
238
240
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
239
241
internal static extern unsafe void RhpFallbackFailFast ( ) ;
240
242
241
- [ RuntimeImport ( Redhawk . BaseName , "RhpSetThreadDoNotTriggerGC" ) ]
243
+ [ RuntimeImport ( RuntimeLibrary , "RhpSetThreadDoNotTriggerGC" ) ]
242
244
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
243
245
internal static extern void RhpSetThreadDoNotTriggerGC ( ) ;
244
246
245
247
[ System . Diagnostics . Conditional ( "DEBUG" ) ]
246
- [ RuntimeImport ( Redhawk . BaseName , "RhpValidateExInfoStack" ) ]
248
+ [ RuntimeImport ( RuntimeLibrary , "RhpValidateExInfoStack" ) ]
247
249
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
248
250
internal static extern void RhpValidateExInfoStack ( ) ;
249
251
250
252
#if TARGET_WINDOWS
251
- [ RuntimeImport ( Redhawk . BaseName , "RhpFirstChanceExceptionNotification" ) ]
253
+ [ RuntimeImport ( RuntimeLibrary , "RhpFirstChanceExceptionNotification" ) ]
252
254
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
253
255
internal static extern void RhpFirstChanceExceptionNotification ( ) ;
254
256
#endif
255
257
256
258
#if TARGET_WINDOWS
257
- [ RuntimeImport ( Redhawk . BaseName , "RhpCopyContextFromExInfo" ) ]
259
+ [ RuntimeImport ( RuntimeLibrary , "RhpCopyContextFromExInfo" ) ]
258
260
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
259
261
internal static extern unsafe void RhpCopyContextFromExInfo ( void * pOSContext , int cbOSContext , EH . PAL_LIMITED_CONTEXT * pPalContext ) ;
260
262
#endif
261
263
262
- [ RuntimeImport ( Redhawk . BaseName , "RhpGetThreadAbortException" ) ]
264
+ [ RuntimeImport ( RuntimeLibrary , "RhpGetThreadAbortException" ) ]
263
265
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
264
266
internal static extern Exception RhpGetThreadAbortException ( ) ;
265
267
266
- [ RuntimeImport ( Redhawk . BaseName , "RhCurrentNativeThreadId" ) ]
268
+ [ RuntimeImport ( RuntimeLibrary , "RhCurrentNativeThreadId" ) ]
267
269
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
268
270
internal static extern unsafe IntPtr RhCurrentNativeThreadId ( ) ;
269
271
@@ -279,21 +281,21 @@ internal static extern unsafe IntPtr RhpCallPropagateExceptionCallback(
279
281
280
282
// Block the current thread until at least one object needs to be finalized (returns true) or
281
283
// memory is low (returns false and the finalizer thread should initiate a garbage collection).
282
- [ DllImport ( Redhawk . BaseName ) ]
284
+ [ DllImport ( RuntimeLibrary ) ]
283
285
internal static extern uint RhpWaitForFinalizerRequest ( ) ;
284
286
285
287
// Indicate that the current round of finalizations is complete.
286
- [ DllImport ( Redhawk . BaseName ) ]
288
+ [ DllImport ( RuntimeLibrary ) ]
287
289
internal static extern void RhpSignalFinalizationComplete ( uint fCount , int observedFullGcCount ) ;
288
290
289
291
// Enters a no GC region, possibly doing a blocking GC if there is not enough
290
292
// memory available to satisfy the caller's request.
291
- [ DllImport ( Redhawk . BaseName ) ]
293
+ [ DllImport ( RuntimeLibrary ) ]
292
294
internal static extern int RhpStartNoGCRegion ( long totalSize , Interop . BOOL hasLohSize , long lohSize , Interop . BOOL disallowFullBlockingGC ) ;
293
295
294
296
// Exits a no GC region, possibly doing a GC to clean up the garbage that
295
297
// the caller allocated.
296
- [ DllImport ( Redhawk . BaseName ) ]
298
+ [ DllImport ( RuntimeLibrary ) ]
297
299
internal static extern int RhpEndNoGCRegion ( ) ;
298
300
}
299
301
}
0 commit comments