JDK-5038535 : Efficiency of SPARC code generated for byte to long conversion
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2004-04-27
  • Updated: 2004-06-15
  • Resolved: 2004-06-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b56Fixed
Related Reports
Relates :  
Description
Please look into optimizing the code generated for the method getLong()
in the following:

public class Optimize {

    private byte[] buffer = new byte[] {1, 0, 0, 0, 0, 0, 0, 0};

    public static void main(String[] args) {
        Optimize opt = new Optimize();
        long l = 0L;
        for (int i = 0; i < 1000000000; i++) {
            l += opt.getLong(i & 7);
        }
        System.out.println("l = " + l);
    }

    public Optimize() {}

    public long getLong(int i) {
        long b = buffer[i] & 0xFFL;
        return b << 32;
    }
}

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-rc FIXED IN: tiger-rc INTEGRATED IN: tiger-b56 tiger-rc
08-07-2004

SUGGESTED FIX *** sparc.ad Tue May 11 14:18:33 2004 --- /net/jano/export/disk05/hotspot/ws/main/c2_baseline/src/cpu/sparc/vm/sparc.ad Thu May 6 20:07:15 2004 *************** *** 461,467 **** %} source %{ ! #pragma ident "%W% %E% %U% JVM" #define __ _masm. --- 461,467 ---- %} source %{ ! #pragma ident "@(#)sparc.ad 1.406 04/05/06 13:42:11 JVM" #define __ _masm. *************** *** 3826,3849 **** interface(CONST_INTER); %} - // Long Immegidate: the value FF - operand immL_FF() %{ - predicate( n->get_long() == 0xFFL ); - match(ConL); - - format %{ %} - interface(CONST_INTER); - %} - - // Long Immegidate: the value FFFF - operand immL_FFFF() %{ - predicate( n->get_long() == 0xFFFFL ); - match(ConL); - - format %{ %} - interface(CONST_INTER); - %} - // Pointer Immediate: 32 or 64-bit operand immP() %{ match(ConP); --- 3826,3831 ---- *************** *** 5728,5734 **** ins_pipe(iload_mask_mem); %} ! // Load Byte (8bit UNsigned) into an Integer reg instruct loadUB(iRegI dst, memory mem, immI_255 bytemask) %{ match(Set dst (AndI (LoadB mem) bytemask)); ins_cost(MEMORY_REF_COST); --- 5710,5716 ---- ins_pipe(iload_mask_mem); %} ! // Load Byte (8bit UNsigned) instruct loadUB(iRegI dst, memory mem, immI_255 bytemask) %{ match(Set dst (AndI (LoadB mem) bytemask)); ins_cost(MEMORY_REF_COST); *************** *** 5740,5769 **** ins_pipe(iload_mask_mem); %} - // Load Byte (8bit UNsigned) into a Long Register - instruct loadUBL(iRegL dst, memory mem, immL_FF bytemask) %{ - match(Set dst (AndL (ConvI2L (LoadB mem)) bytemask)); - ins_cost(MEMORY_REF_COST); - - size(4); - format %{ "LDUB $mem,$dst" %} - opcode(Assembler::ldub_op3); - ins_encode( form3_mem_reg( mem, dst ) ); - ins_pipe(iload_mask_mem); - %} - - // Load Char (16bit UNsigned) into a Long Register - instruct loadUCL(iRegL dst, memory mem, immL_FFFF bytemask) %{ - match(Set dst (AndL (ConvI2L (LoadC mem)) bytemask)); - ins_cost(MEMORY_REF_COST); - - size(4); - format %{ "LDUH $mem,$dst" %} - opcode(Assembler::lduh_op3); - ins_encode( form3_mem_reg( mem, dst ) ); - ins_pipe(iload_mask_mem); - %} - // Load Char (16bit unsigned) instruct loadC(iRegI dst, memory mem) %{ match(Set dst (LoadC mem)); --- 5722,5727 ----
08-07-2004

EVALUATION Will look into post tiger... ###@###.### 2004-04-28 Added a SPARC instruction to handle this special case ###@###.### 2004-05-05
28-04-2004