RFR: 8322636: [JVMCI] HotSpotSpeculationLog can be inconsistent across a single compile [v2]

David Leopoldseder davleopo at openjdk.org
Wed Jan 3 08:52:48 UTC 2024


On Tue, 2 Jan 2024 18:45:41 GMT, Tom Rodriguez <never at openjdk.org> wrote:

>> David Leopoldseder has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8322636: [JVMCI] HotSpotSpeculationLog add javadoc to maySpeculate
>
> More specifically it only validates against the speculations that failed before the last call to collectFailedSpeculations which must always be called explicitly.  And we should point out somewhere that installCode will call collectFailedSpeculations before installation and revalidate the current set of speculations, bailing out if any were violated during compilation.  This doesn't seem to be documented anywhere.

@tkrodriguez  where do you want to put it? 

Id suggest to add some additional javadoc to maySpeculate so we end up with something like


    /**
     * @return {@code true} if the given speculation can be performed, i.e., it never failed so far, otherwise
     * return {@code false}. Note, that this method returns consistent results for any given speculation for the
     * entire lifetime of the enclosing SpeculationLog object. This means that speculations failed during a
     * compilation will not be updated. Validation of speculations only considers those failed since the last
     * call to {@link #collectFailedSpeculations()}. 
     * 
     * Users of {@link SpeculationLog} must explicitly call {@link #collectFailedSpeculations()} to collect
     * failed speculations. This should be done before starting a compile.
     * 
     * Code installation performs a revalidation of the current set of speculations. If this fails, i.e. since the
     * start of the compile new speculations failed, the compilation is aborted with a bailout. This is done in
     * {@link #getFlattenedSpeculations(boolean)}.
     */

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17183#issuecomment-1875022576


More information about the hotspot-compiler-dev mailing list