[Sablevm-user] Re: 64 bit alignment
Brought to you by:
egagnon
From: Etienne M. G. <eg...@j-...> - 2000-11-30 19:33:26
|
Hi Mr. Li, [I would rather have this discussion on the sablevm-user mailing list, as it gets automatically archived. So, I am CC'ing my reply there.] See answer below: xli wrote: > ... > I have a question about 64-bit alignment for double and long values. > For example, when we load a double value, such as 0.0, to the stack, > the following code will be executed: > > DCONST_0: > { > *((jdouble *) &stack[frame->stack_size]) = 0.0; > frame->stack_size += 2; > } > goto *((frame->pc++)->addr); > > How do we know that the current stack address is 64-bit alligned? It will be probably aligned, because of the definition of "stack": _svmt_stack_frame_entry *volatile stack = NULL; where typedef union _svmt_stack_frame_entry_union _svmt_stack_frame_entry; and union _svmt_stack_frame_entry_union { jint jint; jfloat jfloat; void *addr; }; On a 64 bit platform, sizeof(void *) will be 64 bits. All we have to do, now, is make sure the remaining of the stack is aligned (which I have to double check). This is an important point to check. I will need a lot of feedback from people like you to make sure SableVM is easily portable to various systems with a minimal effort. -- ---------------------------------------------------------------------- Etienne M. Gagnon, M.Sc. e-mail: eg...@j-... Author of SableCC: http://www.sable.mcgill.ca/sablecc/ and SableVM: http://www.sablevm.org/ ---------------------------------------------------------------------- |