Convert to SCHEME_OBJECT * first before subtracting membase.
authorTaylor R Campbell <campbell@mumble.net>
Tue, 8 Jan 2019 16:40:11 +0000 (16:40 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Wed, 9 Jan 2019 03:53:03 +0000 (03:53 +0000)
This system (with or without the change) requires all addresses that
are tagged to be word-aligned, which expands the address space by a
factor of four on 32-bit systems, but means we can't tag pointers to
unaligned instruction addresses.

This means that i386 compiled code won't be able to take advantage of
membase, but it can't anyway without changes to the compiler, which
doesn't know about membase as is.

However, this _also_ means that multiclosures in SVM won't work
because only the first entry (and every four or eight entries) is
guaranteed to be word-aligned.  We could address this by aligning the
entries, and maybe remove the ENTER-CLOSURE instruction overhead by
using indirection for entries like riastradh-20181220-closentry-v3
does for amd64.

(Don't want to change CC_ENTRY_NEW_ADDRESS or anything because
there's an outstanding branch that changes them already for other
reasons.)

src/microcode/object.h

index 28799ef942773eaa1239dc7fcbc44a739bd91a2d..02f5641c24f26e05565e2b9398d6c640e771eafc 100644 (file)
@@ -163,7 +163,8 @@ extern SCHEME_OBJECT * memory_base;
 #endif
 
 #ifndef ADDRESS_TO_DATUM
-#  define ADDRESS_TO_DATUM(address) ((SCHEME_OBJECT) ((address) - MEMBASE))
+#  define ADDRESS_TO_DATUM(address)                                    \
+  ((SCHEME_OBJECT) (((SCHEME_OBJECT *) (address)) - MEMBASE))
 #endif
 
 #endif /* not HEAP_IN_LOW_MEMORY */