From af270cb4d8103dd78814963c0ff3f1effd13dcdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Tue, 6 Jan 2015 17:35:44 +0100 Subject: [PATCH] VM converts the methods callstack::frame_top_at and code_block::offset to use cells instead of void*'s --- vm/callstack.cpp | 4 ++-- vm/callstack.hpp | 2 +- vm/code_block_visitor.hpp | 2 +- vm/code_blocks.cpp | 2 +- vm/code_blocks.hpp | 2 +- vm/layouts.hpp | 4 ++-- vm/slot_visitor.hpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vm/callstack.cpp b/vm/callstack.cpp index b2bed5c883..af7c26f907 100644 --- a/vm/callstack.cpp +++ b/vm/callstack.cpp @@ -127,8 +127,8 @@ void factor_vm::primitive_set_innermost_stack_frame_quot() { jit_compile_quot(quot.value(), true); void* inner = stack->top(); - void* addr = *(void**)inner; - code_block* block = code->code_block_for_address((cell)addr); + cell addr = *(cell*)inner; + code_block* block = code->code_block_for_address(addr); cell offset = block->offset(addr); *(void**)inner = (char*)quot->entry_point + offset; } diff --git a/vm/callstack.hpp b/vm/callstack.hpp index d7ae087542..f137701cb4 100644 --- a/vm/callstack.hpp +++ b/vm/callstack.hpp @@ -16,7 +16,7 @@ inline void factor_vm::iterate_callstack_object(callstack* stack_, fixnum frame_offset = 0; while (frame_offset < frame_length) { - cell frame_top = (cell)stack->frame_top_at(frame_offset); + cell frame_top = stack->frame_top_at(frame_offset); cell addr = *(cell*)frame_top; cell fixed_addr = Fixup::translated_code_block_map ? (cell)fixup.translate_code((code_block*)addr) diff --git a/vm/code_block_visitor.hpp b/vm/code_block_visitor.hpp index c931f3450c..6439629c97 100644 --- a/vm/code_block_visitor.hpp +++ b/vm/code_block_visitor.hpp @@ -40,7 +40,7 @@ template struct call_frame_code_block_visitor { void operator()(cell frame_top, cell size, code_block* owner, cell addr) { code_block* compiled = Fixup::translated_code_block_map ? owner : fixup.fixup_code(owner); - cell fixed_addr = compiled->address_for_offset(owner->offset((void*)addr)); + cell fixed_addr = compiled->address_for_offset(owner->offset(addr)); *(cell*)frame_top = fixed_addr; } diff --git a/vm/code_blocks.cpp b/vm/code_blocks.cpp index d89f457b5a..8524cfbb38 100644 --- a/vm/code_blocks.cpp +++ b/vm/code_blocks.cpp @@ -22,7 +22,7 @@ cell code_block::scan(factor_vm* vm, cell addr) const { if (!obj.type_p(QUOTATION_TYPE)) return tag_fixnum(-1); - cell ofs = offset((void*)addr); + cell ofs = offset(addr); return tag_fixnum(vm->quot_code_offset_to_scan(obj.value(), ofs)); } diff --git a/vm/code_blocks.hpp b/vm/code_blocks.hpp index 56fc09e2e7..b1ceab23e1 100644 --- a/vm/code_blocks.hpp +++ b/vm/code_blocks.hpp @@ -92,7 +92,7 @@ struct code_block { } } - cell offset(void* addr) const { return (char*)addr - (char*)entry_point(); } + cell offset(cell addr) const { return addr - (cell)entry_point(); } cell address_for_offset(cell offset) const { return (cell)((char*)entry_point() + offset); diff --git a/vm/layouts.hpp b/vm/layouts.hpp index 701b100163..3622963a78 100644 --- a/vm/layouts.hpp +++ b/vm/layouts.hpp @@ -305,8 +305,8 @@ struct callstack : public object { /* tagged */ cell length; - void* frame_top_at(cell offset) const { - return (void*)((char*)(this + 1) + offset); + cell frame_top_at(cell offset) const { + return (cell)(this + 1) + offset; } void* top() const { return (void*)(this + 1); } diff --git a/vm/slot_visitor.hpp b/vm/slot_visitor.hpp index fddb5d0d53..dd618fbb56 100644 --- a/vm/slot_visitor.hpp +++ b/vm/slot_visitor.hpp @@ -295,7 +295,7 @@ template struct call_frame_slot_visitor { [size] */ void operator()(cell frame_top, cell size, code_block* owner, cell addr) { - cell return_address = owner->offset((void*)addr); + cell return_address = owner->offset(addr); code_block* compiled = Fixup::translated_code_block_map ? owner