RFR : [XS] 8209942: [epsilon] range function for EpsilonTLABElasticity causes compiler warning
Baesken, Matthias
matthias.baesken at sap.com
Wed Sep 5 12:28:32 UTC 2018
Hi Volki ,
The flag EpsilonTLABElasticity is used here :
jdk/src/hotspot/share/gc/epsilon/epsilonHeap.cpp
181 size_t size = requested_size;
182 size_t ergo_tlab = requested_size;
183 int64_t time = 0;
184
185 if (EpsilonElasticTLAB) {
186 ergo_tlab = EpsilonThreadLocalData::ergo_tlab_size(thread);
187
188 if (EpsilonElasticTLABDecay) {
189 int64_t last_time = EpsilonThreadLocalData::last_tlab_time(thread);
190 time = (int64_t) os::javaTimeNanos();
191
192 assert(last_time <= time, "time should be monotonic");
193
194 // If the thread had not allocated recently, retract the ergonomic size.
195 // This conserves memory when the thread had initial burst of allocations,
196 // and then started allocating only sporadically.
197 if (last_time != 0 && (time - last_time > _decay_time_ns)) {
198 ergo_tlab = 0;
199 EpsilonThreadLocalData::set_ergo_tlab_size(thread, 0);
200 }
201 }
202
203 // If we can fit the allocation under current TLAB size, do so.
204 // Otherwise, we want to elastically increase the TLAB size.
205 fits = (requested_size <= ergo_tlab);
206 if (!fits) {
One could check for overflow in the calculation below , but I think this is true for both large DBL or INT ;
but it is another issue .
207 size = (size_t) (ergo_tlab * EpsilonTLABElasticity);
208 }
209 }
Best regards, Matthias
> -----Original Message-----
> From: Volker Simonis <volker.simonis at gmail.com>
> Sent: Mittwoch, 5. September 2018 14:11
> To: Baesken, Matthias <matthias.baesken at sap.com>
> Cc: HotSpot Open Source Developers <hotspot-dev at openjdk.java.net>;
> Aleksey Shipilev <shade at redhat.com>
> Subject: Re: RFR : [XS] 8209942: [epsilon] range function for
> EpsilonTLABElasticity causes compiler warning
>
> Hi Matthias,
>
> your change looks good to me.
>
> Also forwarding to Aleksey who is the initial author of the code.
> @Aleksey: do you think the fix still keeps the intended semantics?
>
> Thank you for fixing this,
> Volker
> On Wed, Sep 5, 2018 at 1:03 PM Baesken, Matthias
> <matthias.baesken at sap.com> wrote:
> >
> > Hello, when compiling jdk/jdk on Windows, (with VS2017 update level
> 15.8 and not disabling warnings as errors )
> > I came across this warning leading to build error :
> >
> > C:/jdk-just-
> clone/src/hotspot/share/runtime/flags/jvmFlagRangeList.cpp(341): error
> C2220: warning treated as error - no 'object' file generated
> > C:/jdk-just-
> clone/src/hotspot/share/runtime/flags/jvmFlagRangeList.cpp(341): warning
> C4305: 'argument': truncation from 'const intx' to 'double'
> >
> > Would have been helpful to have a compiler flag set that really ***shows
> the code*** leading to the warning/error (because it comes from heavy
> macro expansion).
> >
> >
> > The following CR , Reported by
> ralf.schmelter at sap.com<mailto:ralf.schmelter at sap.com> , fixes the issue :
> >
> > The flag -XX:EpsilonTLABElasticity (epsilon_globals.hpp, line 77) expects a
> double value, but uses max_intx in the allowed range.
> > This leads to a truncation warning in the Windows build. If the value should
> only be guaranteed to be >= 1, then DBL_MAX should have been used
> instead.
> >
> >
> > Webrev/bug :
> >
> > http://cr.openjdk.java.net/~mbaesken/webrevs/8209942/
> >
> > https://bugs.openjdk.java.net/browse/JDK-8209942
> >
> >
> > Please review .
> >
> >
> >
> >
> > Thanks, Matthias
More information about the hotspot-dev
mailing list