@@ -57,35 +57,33 @@ class PatchpointTransformer
5757 {
5858 if (block->bbFlags & BBF_PATCHPOINT)
5959 {
60+ // We can't OSR from funclets.
61+ //
62+ assert (!block->hasHndIndex ());
63+
6064 // Clear the patchpoint flag.
6165 //
6266 block->bbFlags &= ~BBF_PATCHPOINT;
6367
64- // If block is in a handler region, don't insert a patchpoint.
65- // We can't OSR from funclets.
66- //
67- // TODO: check this earlier, somehow, and fall back to fully
68- // optimizing the method (ala QJFL=0).
69- if (compiler->ehGetBlockHndDsc (block) != nullptr )
70- {
71- JITDUMP (" Patchpoint: skipping patchpoint for " FMT_BB " as it is in a handler\n " , block->bbNum );
72- continue ;
73- }
74-
75- JITDUMP (" Patchpoint: loop patchpoint in " FMT_BB " \n " , block->bbNum );
76- assert (block != compiler->fgFirstBB );
68+ JITDUMP (" Patchpoint: regular patchpoint in " FMT_BB " \n " , block->bbNum );
7769 TransformBlock (block);
7870 count++;
7971 }
8072 else if (block->bbFlags & BBF_PARTIAL_COMPILATION_PATCHPOINT)
8173 {
82- if (compiler->ehGetBlockHndDsc (block) != nullptr )
83- {
84- JITDUMP (" Patchpoint: skipping partial compilation patchpoint for " FMT_BB
85- " as it is in a handler\n " ,
86- block->bbNum );
87- continue ;
88- }
74+ // We can't OSR from funclets.
75+ // Also, we don't import the IL for these blocks.
76+ //
77+ assert (!block->hasHndIndex ());
78+
79+ // If we're instrumenting, we should not have decided to
80+ // put class probes here, as that is driven by looking at IL.
81+ //
82+ assert ((block->bbFlags & BBF_HAS_CLASS_PROFILE) == 0 );
83+
84+ // Clear the partial comp flag.
85+ //
86+ block->bbFlags &= ~BBF_PARTIAL_COMPILATION_PATCHPOINT;
8987
9088 JITDUMP (" Patchpoint: partial compilation patchpoint in " FMT_BB " \n " , block->bbNum );
9189 TransformPartialCompilation (block);
@@ -248,15 +246,6 @@ class PatchpointTransformer
248246 compiler->gtNewHelperCallNode (CORINFO_HELP_PARTIAL_COMPILATION_PATCHPOINT, TYP_VOID, helperArgs);
249247
250248 compiler->fgNewStmtAtEnd (block, helperCall);
251-
252- // This block will no longer have class probes.
253- // (They will appear in the OSR variant).
254- //
255- if ((block->bbFlags & BBF_HAS_CLASS_PROFILE) != 0 )
256- {
257- JITDUMP (" No longer adding class probes to " FMT_BB " \n " , block->bbNum );
258- block->bbFlags &= ~BBF_HAS_CLASS_PROFILE;
259- }
260249 }
261250};
262251
@@ -282,34 +271,8 @@ PhaseStatus Compiler::fgTransformPatchpoints()
282271 // We should only be adding patchpoints at Tier0, so should not be in an inlinee
283272 assert (!compIsForInlining ());
284273
285- // We currently can't do OSR in methods with localloc.
286- // Such methods don't have a fixed relationship between frame and stack pointers.
287- //
288- // This is true whether or not the localloc was executed in the original method.
289- //
290- // TODO: handle this case, or else check this earlier and fall back to fully
291- // optimizing the method (ala QJFL=0).
292- if (compLocallocUsed)
293- {
294- JITDUMP (" \n -- unable to handle methods with localloc\n " );
295- return PhaseStatus::MODIFIED_NOTHING;
296- }
297-
298- // We currently can't do OSR in synchronized methods. We need to alter
299- // the logic in fgAddSyncMethodEnterExit for OSR to not try and obtain the
300- // monitor (since the original method will have done so) and set the monitor
301- // obtained flag to true (or reuse the original method slot value).
302- if ((info.compFlags & CORINFO_FLG_SYNCH) != 0 )
303- {
304- JITDUMP (" \n -- unable to handle synchronized methods\n " );
305- return PhaseStatus::MODIFIED_NOTHING;
306- }
307-
308- if (opts.IsReversePInvoke ())
309- {
310- JITDUMP (" -- unable to handle Reverse P/Invoke\n " );
311- return PhaseStatus::MODIFIED_NOTHING;
312- }
274+ // We should be allowed to have patchpoints in this method.
275+ assert (compCanHavePatchpoints ());
313276
314277 PatchpointTransformer ppTransformer (this );
315278 int count = ppTransformer.Run ();
0 commit comments