Request for review (L): 7003454: order constants in constant table by number of references in code

Christian Thalinger christian.thalinger at oracle.com
Wed Nov 9 01:45:54 PST 2011


On Nov 8, 2011, at 9:33 PM, Vladimir Kozlov wrote:

> Christian,
> 
> assembler.hpp:
> 
> I don't think we should have separate methods is_simmX() and min_simmX() for cases when it is used only one or 2 times. I would leave only frequently used one (min_simm13() is used only 3 times so it could be removed also):
> 
>  static int min_simm13() { return min_simm(13); }
> 
>  static bool is_simm13(intptr_t x) { return is_simm(x, 13); }
>  static bool is_simm16(intptr_t x) { return is_simm(x, 16); }
>  static bool is_simm32(intptr_t x) { return is_simm(x, 32); }

My reasoning was that defining them doesn't really hurt because they are very small and inlined and the usage is slightly shorter and better to read (in my opinion).  Maybe others are used more often in the future but if the defines are not there nobody will reuse them :-)

> 
> compile.hpp:
> 
> add parenthesis around (++_nof_jump_tables):
> 
> +     float next_jump_table_freq() { return -1.0f * ++_nof_jump_tables; }

Done.

> 
> compile.cpp:
> 
> will you hit next assert if you have several jump-tables?:
> 
> +     else assert(!found_void, "wrong sorting");

No.  All jump-table entries should have been sorted to the end of _constants so when we first hit a T_VOID entry we set found_void to true and only hit T_VOID's after that.  If there is something else after a T_VOID the assert triggers.

-- Chris

> 
> Vladimir
> 
> Christian Thalinger wrote:
>> http://cr.openjdk.java.net/~twisti/7003454/
>> 7003454: order constants in constant table by number of references in code
>> Reviewed-by:
>> Order constants in constant table by frequencies of references in code
>> and set constant table base that offsets to these frequently used
>> constants fit into the displacement range of load instructions.
>> src/share/vm/adlc/adlparse.cpp
>> src/share/vm/adlc/output_c.cpp
>> src/share/vm/asm/assembler.hpp
>> src/share/vm/opto/compile.cpp
>> src/share/vm/opto/compile.hpp
>> src/share/vm/opto/machnode.cpp
>> src/share/vm/opto/matcher.hpp
>> src/cpu/sparc/vm/sparc.ad
>> src/cpu/x86/vm/x86_32.ad
>> src/cpu/x86/vm/x86_64.ad
>> src/cpu/sparc/vm/assembler_sparc.hpp
>> src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
>> src/cpu/sparc/vm/methodHandles_sparc.cpp
>> src/cpu/sparc/vm/sharedRuntime_sparc.cpp
>> src/cpu/sparc/vm/vtableStubs_sparc.cpp
>> src/cpu/x86/vm/assembler_x86.hpp
>> src/cpu/x86/vm/stubGenerator_x86_64.cpp



More information about the hotspot-compiler-dev mailing list