@@ -74,22 +74,22 @@ public static Container singleton() {
7474 }
7575
7676 @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
77- public boolean isContainerized () {
78- return isContainerized ( true ) ;
77+ public boolean isInitialized () {
78+ return STATE . get (). readWord ( 0 ) != State . UNINITIALIZED ;
7979 }
8080
8181 @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
82- public boolean isContainerized (boolean allowInit ) {
82+ public boolean isContainerized () {
8383 if (!isSupported ()) {
8484 return false ;
8585 }
8686
8787 UnsignedWord value = STATE .get ().readWord (0 );
88- if (allowInit && value == State .UNINITIALIZED ) {
88+ if (value == State .UNINITIALIZED ) {
8989 value = initialize ();
9090 }
9191
92- assert value == State .CONTAINERIZED || value == State .NOT_CONTAINERIZED || ! allowInit ;
92+ assert value == State .CONTAINERIZED || value == State .NOT_CONTAINERIZED ;
9393 return value == State .CONTAINERIZED ;
9494 }
9595
@@ -126,7 +126,7 @@ private static UnsignedWord initialize() {
126126
127127 @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
128128 public int getActiveProcessorCount () {
129- VMError .guarantee (isContainerized (false ));
129+ VMError .guarantee (isInitialized () && isContainerized ());
130130
131131 long currentMs = System .currentTimeMillis ();
132132 if (currentMs > activeProcessorCountTimeoutMs ) {
@@ -138,13 +138,13 @@ public int getActiveProcessorCount() {
138138
139139 @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
140140 public int getCachedActiveProcessorCount () {
141- VMError .guarantee (isContainerized (false ));
141+ VMError .guarantee (isInitialized () && isContainerized ());
142142 return cachedActiveProcessorCount ;
143143 }
144144
145145 @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
146146 public UnsignedWord getPhysicalMemory () {
147- VMError .guarantee (isContainerized (false ));
147+ VMError .guarantee (isInitialized () && isContainerized ());
148148
149149 long currentMs = System .currentTimeMillis ();
150150 if (currentMs > physicalMemoryTimeoutMs ) {
@@ -156,13 +156,13 @@ public UnsignedWord getPhysicalMemory() {
156156
157157 @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
158158 public UnsignedWord getCachedPhysicalMemory () {
159- VMError .guarantee (isContainerized (false ));
159+ VMError .guarantee (isInitialized () && isContainerized ());
160160 return cachedPhysicalMemorySize ;
161161 }
162162
163163 @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
164164 public long getMemoryLimitInBytes () {
165- VMError .guarantee (isContainerized (false ));
165+ VMError .guarantee (isInitialized () && isContainerized ());
166166
167167 long currentMs = System .currentTimeMillis ();
168168 if (currentMs > memoryLimitInBytesTimeoutMs ) {
@@ -174,7 +174,7 @@ public long getMemoryLimitInBytes() {
174174
175175 @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
176176 public long getCachedMemoryLimitInBytes () {
177- VMError .guarantee (isContainerized (false ));
177+ VMError .guarantee (isInitialized () && isContainerized ());
178178 return cachedMemoryLimitInBytes ;
179179 }
180180
0 commit comments