[Vm-dev] VM patches for oop comparison and usqInt declarations

David T. Lewis lewis at mail.msen.com
Wed Apr 25 10:59:49 UTC 2007


The attached zip contains six change sets and an update for sqMemoryAccess.h.
The changes are intended to resolve problems with oop variable declarations
and comparison operations that may occur on platforms that assign object
memory to high virtual memory address values.

Dave

The change set preambles are:

=== VmUpdates-1001-dtl.1.cs ===
Change Set:		VmUpdates-1001-dtl
Date:			23 April 2007
Author:			David T. Lewis

Remove several unreferenced primitives. These have no apparent utility in the current VM. They contain type casts that are probably incorrect, that that produce compiler warnings on 64 bit host/32 bit image VM builds.

This is the first of several change sets that address object memory addressing issues, particularly for host machines that may assign object memory addresses in the high order range of an unsigned 32 bit address space. The changes address oop comparison and type conversion within the object memory and interpreter.

Prerequisites are:
1) VMMaker 3.8b6 (from file VMMaker-tpr.58.mcz).
2) Update to sqMemoryAccess.h with the following changes:
85c85
<   static inline char *pointerForOop(sqInt oop)                        { return sqMemoryBase + oop; }
---
>   static inline char *pointerForOop(usqInt oop)                       { return sqMemoryBase + oop; }
109,110c109,110
< # define pointerForOop(oop)           ((char *)(sqMemoryBase + (oop)))
< # define oopForPointer(ptr)           ((sqInt)(ptr))
---
> # define pointerForOop(oop)           ((char *)(sqMemoryBase + ((usqInt)(oop))))
> # define oopForPointer(ptr)           ((sqInt)(((char *)(ptr)) - (sqMemoryBase)))

Other patches are required for various 64 bit host/image combinations, but are not directly relevent to this series of updates. See Mantis for details.

=== VmUpdates-1002-dtl.1.cs ===
Change Set:		VmUpdates-1002-dtl
Date:			23 April 2007
Author:			David T. Lewis

Declare globals for oops in ObjectMemory and Interpreter as type usqInt.

=== VmUpdates-1003-dtl.1.cs ===
Change Set:		VmUpdates-1003-dtl
Date:			23 April 2007
Author:			David T. Lewis

Add oop comparison methods.
  ObjectMemory>>oop:isGreaterThan:
  ObjectMemory>>oop:isGreaterThanOrEqual:
  ObjectMemory>>oop:isLessThan:
  ObjectMemory>>oop:isLessThanOrEqual:

These use #cCoerce:to: to cast their arguments to unsigned usqInt. They are inlined during C translation so performance is not impacted.

Notes: Any explicit C variable declarations in methods will prevent the methods from being inlined. These four new methods, when implemented in ObjectMemory, do the required type casts without disabling inlining. Also, the methods must be implemented here rather than in Object in order for the inlining to work.

=== VmUpdates-1004-dtl.1.cs ===
Change Set:		VmUpdates-1004-dtl
Date:			23 April 2007
Author:			David T. Lewis

Use new oop comparison methods throughout ObjectMemory wherever necessary to ensure unsigned operands. In some methods, the original comparison operators are used if referencing globals declared as usqInt, or if the methods are not inlined so that local declarations may be used.

Updated #sufficientSpaceAfterGC:, #sufficientSpaceToAllocate:  and #allocateChunk to use the new methods rather than Ian's original casts.

=== VmUpdates-1005-dtl.1.cs ===
Change Set:		VmUpdates-1005-dtl
Date:			23 April 2007
Author:			David T. Lewis

Use new oop comparison methods throughout Interpreter wherever necessary to ensure unsigned operands. In some methods, the original comparison operators are used if referencing globals declared as usqInt, or if the methods are not inlined so that local declarations may be used.

Update #stObject:at: and #stObject:at:put: to use the new comparison methods rather than Ian's original casts.

=== VmUpdates-1006-dtl.1.cs ===
Change Set:		VmUpdates-1006-dtl
Date:			23 April 2007
Author:			David T. Lewis

Removed unnecessary type cast in #biasToGrowCheckGCLimit. JMM please double-check this and make sure I did not mess up your original intent.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: VmUpdates-dtl.zip
Type: application/zip
Size: 27276 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20070425/6fe87b90/VmUpdates-dtl-0001.zip


More information about the Vm-dev mailing list