3535import com .oracle .graal .pointsto .AnalysisPolicy ;
3636import com .oracle .graal .pointsto .BigBang ;
3737import com .oracle .graal .pointsto .PointsToAnalysis ;
38- import com .oracle .graal .pointsto .api .PointstoOptions ;
3938import com .oracle .graal .pointsto .flow .AbstractSpecialInvokeTypeFlow ;
4039import com .oracle .graal .pointsto .flow .AbstractStaticInvokeTypeFlow ;
4140import com .oracle .graal .pointsto .flow .AbstractVirtualInvokeTypeFlow ;
7978import jdk .vm .ci .code .BytecodePosition ;
8079import jdk .vm .ci .meta .JavaConstant ;
8180
82- public class BytecodeSensitiveAnalysisPolicy extends AnalysisPolicy {
81+ public final class BytecodeSensitiveAnalysisPolicy extends AnalysisPolicy {
8382
8483 private final BytecodeAnalysisContextPolicy contextPolicy ;
8584
@@ -143,7 +142,7 @@ public boolean isContextSensitiveAllocation(PointsToAnalysis bb, AnalysisType ty
143142
144143 @ Override
145144 public AnalysisObject createHeapObject (PointsToAnalysis bb , AnalysisType type , BytecodePosition allocationSite , AnalysisContext allocationContext ) {
146- assert PointstoOptions . AllocationSiteSensitiveHeap . getValue ( options ) ;
145+ assert allocationSiteSensitiveHeap ;
147146 if (isContextSensitiveAllocation (bb , type , allocationContext )) {
148147 return new AllocationContextSensitiveObject (bb , type , allocationSite , allocationContext );
149148 } else {
@@ -268,7 +267,7 @@ public void linkClonedObjects(PointsToAnalysis bb, TypeFlow<?> inputFlow, CloneT
268267
269268 @ Override
270269 public FieldTypeStore createFieldTypeStore (PointsToAnalysis bb , AnalysisObject object , AnalysisField field , AnalysisUniverse universe ) {
271- assert PointstoOptions . AllocationSiteSensitiveHeap . getValue ( options ) ;
270+ assert allocationSiteSensitiveHeap ;
272271 if (object .isContextInsensitiveObject ()) {
273272 /*
274273 * Write flow is context-sensitive and read flow is context-insensitive. This split is
@@ -296,7 +295,7 @@ public FieldTypeStore createFieldTypeStore(PointsToAnalysis bb, AnalysisObject o
296295
297296 @ Override
298297 public ArrayElementsTypeStore createArrayElementsTypeStore (AnalysisObject object , AnalysisUniverse universe ) {
299- assert PointstoOptions . AllocationSiteSensitiveHeap . getValue ( options ) ;
298+ assert allocationSiteSensitiveHeap ;
300299 if (object .type ().isArray ()) {
301300 if (aliasArrayTypeFlows ) {
302301 /* Alias all array type flows using the elements type flow model of Object type. */
@@ -345,7 +344,7 @@ public MethodFlowsGraphInfo staticRootMethodGraph(PointsToAnalysis bb, PointsToA
345344
346345 @ Override
347346 public AnalysisContext allocationContext (PointsToAnalysis bb , MethodFlowsGraph callerGraph ) {
348- return contextPolicy .allocationContext ((BytecodeAnalysisContext ) ((MethodFlowsGraphClone ) callerGraph ).context (), PointstoOptions . MaxHeapContextDepth . getValue ( bb . getOptions ()) );
347+ return contextPolicy .allocationContext ((BytecodeAnalysisContext ) ((MethodFlowsGraphClone ) callerGraph ).context (), maxHeapContextDepth );
349348 }
350349
351350 @ Override
@@ -595,7 +594,7 @@ public TypeState doUnion(PointsToAnalysis bb, MultiTypeState state1, MultiTypeSt
595594 return doUnion0 (bb , s1 , s2 , resultCanBeNull );
596595 }
597596
598- private static TypeState doUnion0 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull ) {
597+ private TypeState doUnion0 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull ) {
599598
600599 /* Speculate that s1 and s2 are distinct sets. */
601600
@@ -631,8 +630,8 @@ private static TypeState doUnion0(PointsToAnalysis bb, ContextSensitiveMultiType
631630 return doUnion1 (bb , s1 , s2 , resultCanBeNull );
632631 }
633632
634- private static TypeState doUnion1 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull ) {
635- if (PointstoOptions . AllocationSiteSensitiveHeap . getValue ( bb . getOptions ()) ) {
633+ private TypeState doUnion1 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull ) {
634+ if (allocationSiteSensitiveHeap ) {
636635 return allocationSensitiveSpeculativeUnion1 (bb , s1 , s2 , resultCanBeNull );
637636 } else {
638637 return allocationInsensitiveSpeculativeUnion1 (bb , s1 , s2 , resultCanBeNull );
@@ -642,7 +641,7 @@ private static TypeState doUnion1(PointsToAnalysis bb, ContextSensitiveMultiType
642641 /**
643642 * Optimization that gives 1.5-3x in performance for the (typeflow) phase.
644643 */
645- private static TypeState allocationInsensitiveSpeculativeUnion1 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull ) {
644+ private TypeState allocationInsensitiveSpeculativeUnion1 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull ) {
646645 if (s1 .bitSet ().length () >= s2 .bitSet ().length ()) {
647646 long [] bits1 = TypeStateUtils .extractBitSetField (s1 .bitSet ());
648647 long [] bits2 = TypeStateUtils .extractBitSetField (s2 .bitSet ());
@@ -664,7 +663,7 @@ private static TypeState allocationInsensitiveSpeculativeUnion1(PointsToAnalysis
664663 return doUnion2 (bb , s1 , s2 , resultCanBeNull , 0 , 0 );
665664 }
666665
667- private static TypeState allocationSensitiveSpeculativeUnion1 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull ) {
666+ private TypeState allocationSensitiveSpeculativeUnion1 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull ) {
668667 int idx1 = 0 ;
669668 int idx2 = 0 ;
670669 AnalysisPolicy analysisPolicy = bb .analysisPolicy ();
@@ -701,7 +700,7 @@ private static TypeState allocationSensitiveSpeculativeUnion1(PointsToAnalysis b
701700 private static final ThreadLocal <UnsafeArrayListClosable <AnalysisObject >> doUnion2TL = new ThreadLocal <>();
702701 private static final ThreadLocal <UnsafeArrayListClosable <AnalysisObject >> doUnion2ObjectsTL = new ThreadLocal <>();
703702
704- private static TypeState doUnion2 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull , int startId1 , int startId2 ) {
703+ private TypeState doUnion2 (PointsToAnalysis bb , ContextSensitiveMultiTypeState s1 , ContextSensitiveMultiTypeState s2 , boolean resultCanBeNull , int startId1 , int startId2 ) {
705704 try (UnsafeArrayListClosable <AnalysisObject > resultObjectsClosable = getTLArrayList (doUnion2TL , s1 .objects .length + s2 .objects .length )) {
706705 UnsafeArrayList <AnalysisObject > resultObjects = resultObjectsClosable .list ();
707706 /* Add the beginning of the s1 list that we already walked above. */
@@ -757,7 +756,7 @@ private static TypeState doUnion2(PointsToAnalysis bb, ContextSensitiveMultiType
757756 * Check if the union of objects of a type in the overlapping section reached the
758757 * limit. The limit, bb.options().maxObjectSetSize(), has a minimum value of 1.
759758 */
760- if (PointstoOptions . LimitObjectArrayLength . getValue ( bb . getOptions ()) && unionObjects .size () > PointstoOptions . MaxObjectSetSize . getValue ( bb . getOptions ()) ) {
759+ if (limitObjectArrayLength && unionObjects .size () > maxObjectSetSize ) {
761760 int idxStart = 0 ;
762761 int idxEnd = 0 ;
763762 while (idxEnd < unionObjects .size ()) {
@@ -772,7 +771,7 @@ private static TypeState doUnion2(PointsToAnalysis bb, ContextSensitiveMultiType
772771 * stride
773772 */
774773 int size = idxEnd - idxStart ;
775- if (size > PointstoOptions . MaxObjectSetSize . getValue ( bb . getOptions ()) ) {
774+ if (size > maxObjectSetSize ) {
776775 /*
777776 * Object count exceeds the limit. Mark the objects in the stride as
778777 * merged.
0 commit comments