Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 8134 - Optimize references to class variables
Summary: Optimize references to class variables
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-23 10:23 EST by shmuel siegel CLA
Modified: 2009-08-30 02:39 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shmuel siegel CLA 2002-01-23 10:23:16 EST
The virtual machine on many embedded devices does not do runtime optimation. It 
would therefore be nice if the compiler performed certain optimizations which 
although they could have been done by the programmer they would interfere with 
the understanding of the code. In the following class (initialization and error 
checking code has been removed)fastCRC runs twice as fast as slowCRC on a 
Motorola i85s phone, but no programmer wants to write code like fastCRC. 
Eclipse's compiler should have an option to perform this kind of optimization.

public class CRC32
{
/**
* Table of CRC-32's of all single-byte values
*/

static int crc_table[];
public static int crc;

    static public int slowCRC(byte[] buf, int offset, int len)
    {
        for(;len>0; offset++,len--)
        {
            crc = crc_table[(crc ^ buf[offset]) & 0xff] ^ ((crc >> 8)&0xffffff);
        }
        crc = crc ^ 0xFFFFFFFF;

        return crc;
    }

    static public int fastCRC(byte[] buf, int offset, int len)
    {
        int lcrc = crc ^ 0xFFFFFFFF;
        int[] ltable = crc_table;
        for(;len>0; offset++,len--)
        {
            lcrc = ltable[(lcrc ^ buf[offset]) & 0xff] ^ ((lcrc >> 8)&0xffffff);
        }
        crc = lcrc ^ 0xFFFFFFFF;

        return crc;
    }

}
Comment 1 Philipe Mulet CLA 2002-01-24 07:48:20 EST
We might consider more bytecode optimizations after R2.0.
Is it ok ? It will not get lost.
Comment 2 shmuel siegel CLA 2002-01-27 06:56:31 EST
The current optimizations assume that a JIT will be executing the bytecode. For 
MIDP devices it seems that the bytecodes are executed directly. An option for 
inlining or similar optimizations would really help for these platforms.
Comment 3 Philipe Mulet CLA 2002-02-26 13:04:41 EST
Shmuel,

Would you be interested in implementing these changes ?
Comment 4 Philipe Mulet CLA 2002-06-04 10:17:00 EDT
Defer
Comment 5 Eclipse Webmaster CLA 2009-08-30 02:39:41 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.