Additional type corrections
Greg Lewis
glewis at eyesbeyond.com
Tue Jan 20 12:13:00 PST 2009
G'day Kurt,
On Tue, Jan 20, 2009 at 11:20:58AM -0500, Kurt Miller wrote:
> Here are more datatype corrections for the bsd-port tree. I've
> tested a variation of this diff on my OpenBSD port (the bsd-port
> tree doesn't build yet on OpenBSD; still a work in progress). These
> should be committed and then we need to extract all the datatype
> corrections for submitting a new bug report for the main tree.
>
> The changes are as follows:
> - There is no movptr(Address, int32_t) function for x86/32 bit.
> Casting to int32_t for movptr on x86/32 should be avoided. Instead
> cast directly to intptr_t where needed.
> - Several places in the x86/32 code movl is directly used where
> movptr is the correct function. movptr on x86/32 ends up using
> movl but deals with the type variations without the need for
> additional casts.
> - Use NULL_WORD to assign a NULL value to intptr_t instead of
> (intptr_t) NULL
Sorry about that one.
These look good to me (thanks for doing them!) and I've successfully test
compiled with them on Mac OS X with no apparent side effects :).
> diff -r b86ce5362022 src/cpu/x86/vm/interp_masm_x86_32.cpp
> --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp Sun Jan 18 21:42:26 2009 -0800
> +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp Tue Jan 20 10:49:33 2009 -0500
> @@ -149,7 +149,7 @@
> // Clean up tos value in the thread object
> movl(tos_addr, (int32_t) ilgl);
> movptr(val_addr, NULL_WORD);
> - NOT_LP64(movl(val_addr1, (int32_t)NULL_WORD));
> + NOT_LP64(movptr(val_addr1, NULL_WORD));
> }
>
>
> @@ -473,7 +473,7 @@
> movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n+1)), (intptr_t)frame::TagValue);
> movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (intptr_t)frame::TagValue);
> } else {
> - movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)tag);
> + movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (intptr_t)tag);
> }
> }
> }
> @@ -487,7 +487,7 @@
> Interpreter::local_tag_offset_in_bytes(0)), (intptr_t)frame::TagValue);
> } else {
> movptr(Address(rdi, idx, Interpreter::stackElementScale(),
> - Interpreter::local_tag_offset_in_bytes(0)), (int32_t)tag);
> + Interpreter::local_tag_offset_in_bytes(0)), (intptr_t)tag);
> }
> }
> }
> @@ -1319,7 +1319,7 @@
> int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row));
> set_mdp_data_at(mdp, recvr_offset, receiver);
> int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row));
> - movptr(reg2, (int32_t)DataLayout::counter_increment);
> + movptr(reg2, (intptr_t)DataLayout::counter_increment);
> set_mdp_data_at(mdp, count_offset, reg2);
> jmp(done);
> }
> @@ -1458,7 +1458,7 @@
> test_method_data_pointer(mdp, profile_continue);
>
> // Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes()
> - movptr(reg2, (int32_t)in_bytes(MultiBranchData::per_case_size()));
> + movptr(reg2, (intptr_t)in_bytes(MultiBranchData::per_case_size()));
> // index is positive and so should have correct value if this code were
> // used on 64bits
> imulptr(index, reg2);
> diff -r b86ce5362022 src/cpu/x86/vm/interpreterRT_x86_32.cpp
> --- a/src/cpu/x86/vm/interpreterRT_x86_32.cpp Sun Jan 18 21:42:26 2009 -0800
> +++ b/src/cpu/x86/vm/interpreterRT_x86_32.cpp Tue Jan 20 10:49:33 2009 -0500
> @@ -110,7 +110,7 @@
> virtual void pass_object() {
> // pass address of from
> intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0));
> - *_to++ = (*(intptr_t*)from_addr == 0) ? (intptr_t) NULL : from_addr;
> + *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr;
> debug_only(verify_tag(frame::TagReference));
> _from -= Interpreter::stackElementSize();
> }
> diff -r b86ce5362022 src/cpu/x86/vm/templateTable_x86_32.cpp
> --- a/src/cpu/x86/vm/templateTable_x86_32.cpp Sun Jan 18 21:42:26 2009 -0800
> +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp Tue Jan 20 10:49:33 2009 -0500
> @@ -137,10 +137,10 @@
> // Do the actual store
> // noreg means NULL
> if (val == noreg) {
> - __ movl(Address(rdx, 0), (int32_t)NULL_WORD);
> + __ movptr(Address(rdx, 0), NULL_WORD);
> // No post barrier for NULL
> } else {
> - __ movl(Address(rdx, 0), val);
> + __ movptr(Address(rdx, 0), val);
> __ g1_write_barrier_post(rdx, rax, rcx, rbx, rsi);
> }
> __ restore_bcp();
> @@ -152,9 +152,9 @@
> case BarrierSet::CardTableExtension:
> {
> if (val == noreg) {
> - __ movl(obj, (int32_t) NULL_WORD);
> + __ movptr(obj, NULL_WORD);
> } else {
> - __ movl(obj, val);
> + __ movptr(obj, val);
> // flatten object address if needed
> if (!precise || (obj.index() == noreg && obj.disp() == 0)) {
> __ store_check(obj.base());
> @@ -168,9 +168,9 @@
> case BarrierSet::ModRef:
> case BarrierSet::Other:
> if (val == noreg) {
> - __ movl(obj, (int32_t) NULL_WORD);
> + __ movptr(obj, NULL_WORD);
> } else {
> - __ movl(obj, val);
> + __ movptr(obj, val);
> }
> break;
> default :
--
Greg Lewis Email : glewis at eyesbeyond.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : glewis at FreeBSD.org
More information about the bsd-port-dev
mailing list