Skip to content

Changes

Summary

  1. Define TR::map and TR::set analogously to TR::vector and TR::list (commit: 3db10b2) (details)
  2. Facilitate recording of constants observed in call target selection (commit: d87f2bb) (details)
Commit 3db10b2385ba591e9ca7ebd5e31d009d0aa4b30d by Devin Papineau
Define TR::map and TR::set analogously to TR::vector and TR::list

When using std::map and std::set directly, the TR::typed_allocator must
always be specified explicitly. Since the allocator parameter is last,
the comparator must be given explicitly as well even if the default of
std::less would be appropriate, which is often the case. As a result,
typical uses of std::map and std::set take up multiple lines just to
write down the type.

Additionally, when specifying the allocator for std::map, the key
(first) type in the std::pair type provided to TR::typed_allocator must
be const-qualified. In the past it has been possible to forget const,
which resulted in strange consequences. For example, here's a commit
adding a forgotten const: 10dbf7e4e591ba0e.

This commit defines subtypes TR::map and TR::set that take care of
wrapping the allocator in TR::typed_allocator. The default allocator
(TR::Region&) should almost always be usable, in which case it can be
omitted, and it might also be possible to omit the comparator. (Note
that this default differs from that of TR::vector and TR::list, but
TR::Region& might arguably be a better default for those as well.)
(commit: 3db10b2)
The file was addedcompiler/infra/map.hpp
The file was addedcompiler/infra/set.hpp
Commit d87f2bbeef064b7a3c779c676aea897327698a3b by Devin Papineau
Facilitate recording of constants observed in call target selection

If inlining uses constant folding to help determine call targets, then
it's important for the corresponding IL (if any is generated) to be
consistent with what the inliner saw.

This commit equips TR_CallTarget with a collection of observed constants
that must be folded consistently in IL. This collection can be populated
by an inliner and later consulted by an IL generator to ensure that the
operations are folded as needed.

This repeated folding is important whenever a value might be allowed to
be folded despite the possibility of a later change. It also allows
constants to be speculative by specifying the assumptions that are
necessary in order for the folding to be correct, and by informing the
IL generator of the locations where such assumptions have been made.
(commit: d87f2bb)
The file was modified compiler/optimizer/Inliner.cpp (diff)
The file was modified compiler/compile/OMRCompilation.cpp (diff)
The file was addedcompiler/il/AnyConst.hpp
The file was modified compiler/optimizer/CallInfo.hpp (diff)
The file was modified compiler/optimizer/abstractinterpreter/OMRIDTBuilder.cpp (diff)
The file was addedcompiler/optimizer/DeferredOSRAssumption.hpp
The file was modified compiler/compile/OMRCompilation.hpp (diff)