Looking for 64 Bit computation in VS 2005
I tried a test program with VS2005 in the 64 bit windows on AMD 64 by calling Math.cos(1) function, and I compiled the program under the 64x platform setting, but when I stepped and looked into the cpu registers, only lower half of the registers was used, the upper half was filled with zeros. VS 2005 claims to support 64 bit, is this the way it suppose to support it? By using only half of the register? Is there a way to take the full use of the machine?
[585 byte] By [
JHW] at [2008-2-4]
As you noted the X64 registers are 8bytes. You also have made note of an allocation scheme used by Windows: namely allocating in lower memory first.
I can assure you that you are able to access memory above the 4 gig boundary. Depending on the amount of virutal memory your machine has you can allocate multiple multi gig objects. You could then do a "Debug.EvaluateStatement &<var name>" to get the objects address.
Here is an example:
static void Main(string[] args)
{
int[] iss = new int[268435456];
int[] iss2 = new int[268435456];
int[] iss3 = new int[268435456];
iss[0] = 0;
iss2[0] = 1;
iss3[0] = 2;
} >Debug.EvaluateStatement &iss
0x000000001b4ee650
*&iss: 0x000000007fff1000
>Debug.EvaluateStatement &iss2
0x000000001b4ee658
*&iss2: 0x00000000c3ff1000
>Debug.EvaluateStatement &iss3
0x000000001b4ee660
*&iss3: 0x0000000107ff1000 // above the 4 gig barrior
Hope that this explains why you were seeing only the lower 4 bytes of the registers being used.
Jeff