Problems with latest VM

Jaco van der Merwe jaco.lists at telkomsa.net
Sun Aug 8 05:39:11 PDT 2004


Hi all,

I've just downloaded the latest VM and slate sources. I compiled the VM with
Visual C++. I made both a debug and a release build. The debug build VM
seems to work (at least it loads the image without problems). However, the
release build fails fairly early while loading the image with an unhandled
signal message, after which the VM exits.

The fact that the debug and release builds behave differently still
indicates to me that the VM code accesses memory somewhere that is
uninitialised, or not intended to be accessed. Therefore, although the debug
build seems to run, it may be hiding the problem or just postponing it to
many instructions later. I'm not sure how to proceed with debugging the
unhandled signal case mostly because I don't understand the underlying
mechanisms used in the vm. I'll appreciate it if someone can explain it to
me. Then, maybe I'll be able to debug this case.

Also, when compiling the sources the compiler generates the following
warning which seems suspicious to me:

   vm.c(3021) : warning C4047: '=' : 'ObjectPointer *' differs in levels of
indirection from 'ObjectPointer (*)[]'

The offending line of code is as follows:

   vars = &lexicalContext->variables;

where vars and lexicalContext are defined as follows:

   ObjectPointer * vars;
   struct LexicalContext * lexicalContext;

and LexicalContext is as follows:

   struct LexicalContext {
      struct ObjectHeader header;
      struct Map * map;
      ObjectPointer traits;
      ObjectPointer unwindBlock;
      ObjectPointer variables[0];
   };

This does not seem correct to me. Shouldn't the offending line of code read
as follows?

   vars = lexicalContext->variables;

Also, the following suspicious warning still remains. This has previously
been reported by me and other people.

   file.c(136) : warning C4146: unary minus operator applied to unsigned
type, result still unsigned

The offending line of code is:

   PSObjectHeap_adjustAllOopsBy_ (CurrentMemory, - (unsigned)
CurrentMemory -> memory);

where the function signature is:

   unsigned long int PSObjectHeap_adjustAllOopsBy_(struct ObjectHeap * h,
unsigned long int shiftAmountInBytes)

Why give an explicit negative argument to a formal argument that is
unsigned?

Regards

Jaco van der Merwe




More information about the Slate mailing list