|
We do not require your compiler to support 64-bit arithmetic. However, having a 64-bit capable compiler makes porting much easier.
If your compiler supports 64-bit integers, you should define the types long64 and ulong64 in one of your platform-dependent include files. The meaning of these two types is shown below in
|
Type
|
Description
|
|||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
long64
|
A signed 64-bit integer.
|
|||||||||||||
|
ulong64
|
An unsigned 64-bit integer.
|
|||||||||||||
You should consider setting one of the two compiler constants BIG_ENDIAN or LITTLE_ENDIAN to a non-zero value. This is only required if you are using the Java Code Compactor, but KVM can produce better code if it knows the endianness of your machine.
For example, using the Gnu C compiler or the Solaris C compiler, you would write:
Using Microsoft Visual C/C++, you would write:
If Your compiler does not support 64-bit integers,1 you must set the preprocessor constant COMPILER_SUPPORTS_LONG to zero. You must define exactly one of BIG_ENDIAN or LITTLE_ENDIAN2 to have a non-zero value.
The types long64 and ulong64 are defined to be a structure consisting of two fields, each an unsigned long word, named high and low. The high field is first if your machine is big endian; the low field is first if your machine is little endian.
You must define the functions shown in Table 8. If your platform supports floating point, you must also define the functions shown in Table 9.
Any of these functions can be implemented as a macro instead.
When an object of Java type long or double is on the Java stack or in the constant pool, its address will be a multiple of 4.
Some hardware platforms (such as SPARC) require that 64-bit types be aligned so that their address is a multiple of 8.
If your platform requires that 64-bit integers be aligned on 8-byte boundaries, set
If your platform requires double-precision floating point numbers be aligned on 8-byte boundaries, set
The compiler can generates better code when these values are 0.
|
KVM Porting Guide , CLDC 1.1 |
Copyright © 2003 Sun Microsystems, Inc. All rights reserved.