Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004608 [Squeak] VM crash always 08-19-06 16:22 05-27-08 18:41
Reporter maku View Status public  
Assigned To tim
Priority normal Resolution fixed  
Status closed   Product Version 3.9
Summary 0004608: bug in Cross/vm/sqMemoryAccess.h
Description The file Cross/vm/sqMemoryAccess.h has 2 sets of memory access functions. One defined as inline functions, the other one defined as macros. The macro for oopForPointer is different from the inline version:
        # define oopForPointer(ptr) ((sqInt)(ptr))
vs
        static inline sqInt oopForPointer(char *ptr)
                 { return (sqInt)(ptr - sqMemoryBase); }

When compiling a VM on linux 2.6.17, x86_64 (debian sid) using gcc 4.1.2, the macro version is used and the resulting VM crashes on startup. Using the inline version solves the problem.
Additional Information Wether inline functions or macros are used is controlled by the variable
USE_INLINE_MEMORY_ACCESSORS. The macro versions are used by default and there does not seem to be any code in the configure script to set the variable.
Attached Files  sqMemoryAccess.h.diff.2.zip [^] (594 bytes) 05-20-07 17:45

- Relationships
child of 0006671closed tim Build VMMaker for 3.9 

- Notes
(0006795 - 191 - 215 - 215 - 215 - 215 - 215)
lewis
08-28-06 05:57

I think that the correct macro is:

# define oopForPointer(ptr) ((sqInt)(((char *)(ptr)) - (sqMemoryBase)))

This works on 32 bit host/32 bit image. I have not yet tried it on 64 bit AMD.
 
(0010507 - 148 - 148 - 148 - 148 - 148 - 148)
lewis
04-09-07 21:16

sqMemoryAccess.h.diff is the patch file to correct this problem. After applying this patch, the VM can be build on 64 bit AMD host for 32 bit image.
 
(0010611 - 460 - 460 - 460 - 460 - 460 - 460)
lewis
04-23-07 23:30

It turns out that the pointerForOop() function and macro are also in need of attention, inasmuch as they produce an incorrect sign extention when running on 64 bit hosts with 32 bit images. The oop 0xffffffff should be cast to a 64 bit machine pointer of 0x00000000ffffffff, not 0xffffffffffffffff as occurs with the current implementation. The fix is to use usqInt parameters for oops rather than sqInt. I have attached the fix in sqMemoryAccess.h.diff.2.zip.
 
(0010825 - 44 - 44 - 44 - 44 - 44 - 44)
lewis
06-22-07 11:54

The changes have been committed to SVN 1709.
 
(0010826 - 49 - 49 - 49 - 49 - 49 - 49)
lewis
06-22-07 11:56

Resolved by SVN 1709, no further action required.
 

- Issue History
Date Modified Username Field Change
08-19-06 16:22 maku New Issue
08-21-06 19:41 tim Status new => assigned
08-21-06 19:41 tim Assigned To  => tim
08-28-06 04:35 lewis Issue Monitored: lewis
08-28-06 05:57 lewis Note Added: 0006795
04-09-07 21:16 lewis Note Added: 0010507
04-23-07 23:30 lewis Note Added: 0010611
05-20-07 17:45 lewis File Added: sqMemoryAccess.h.diff.2.zip
06-22-07 11:54 lewis Note Added: 0010825
06-22-07 11:56 lewis Note Added: 0010826
09-14-07 00:02 tim Relationship added child of 0006671
05-27-08 18:41 tim Status assigned => closed
05-27-08 18:41 tim Resolution open => fixed


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
62 total queries executed.
41 unique queries executed.
Powered by Mantis Bugtracker