<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Dave,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 1, 2022 at 1:07 PM David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <br>
Hi Eliot,<br>
<br>
I put VMMaker.oscog-dtl.3124 in the VMM inbox, which includes your<br>
recommendations along with a few unit tests to cover the format number<br>
handling.<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Cool.  The definition and initialization of the new StackInterpreter multipleBytecodeSetsActive inst var is missing. I'm assuming it is an inst var.  How should it be initialized?  From MULTIPLEBYTECODESETS or left false by default?</div><div class="gmail_default" style="font-size:small"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Dave<br>
<br>
On Sun, Dec 26, 2021 at 08:49:04PM -0500, David T. Lewis wrote:<br>
>  <br>
> Thanks Eliot,<br>
> <br>
> I will do an update in the VMM inbox in the next day or so.<br>
> <br>
> Dave<br>
> <br>
> <br>
> On Sun, Dec 26, 2021 at 01:26:03PM -0800, Eliot Miranda wrote:<br>
> >  <br>
> > Hi Dave,<br>
> > <br>
> > On Sun, Dec 26, 2021 at 12:35 PM David T. Lewis <<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>> wrote:<br>
> > <br>
> > ><br>
> > > My apologies, I intended this for the VMMaker inbox. I will move it there<br>
> > > now.<br>
> > <br>
> > <br>
> > no problem.<br>
> > <br>
> > On Sun, Dec 26, 2021 at 12:23 PM <<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>> wrote:<br>
> > <br>
> > ><br>
> > > David T. Lewis uploaded a new version of VMMaker to project VM Maker:<br>
> > > <a href="http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.3123.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.3123.mcz</a><br>
> > ><br>
> > > ==================== Summary ====================<br>
> > ><br>
> > > Name: VMMaker.oscog-dtl.3123<br>
> > > Author: dtl<br>
> > > Time: 26 December 2021, 12:55:15.357105 pm<br>
> > > UUID: a0d4db62-a6ac-4d9c-ba51-5eec2ce0c415<br>
> > > Ancestors: VMMaker.oscog-eem.3122<br>
> > ><br>
> > > Support image formats 68533 and 7033. Let the image inform the VM that<br>
> > > alternate bytecodes either are or are not in use, and remember the setting<br>
> > > when writing or reading the image format number in a shapshot file header.<br>
> > > Also support testing the current value of multipleBytecodeSetsActive, and<br>
> > > listing the encoder names of supported bytecode sets.<br>
> > ><br>
> > <br>
> > This is cool. But let me suggest...<br>
> > <br>
> > > Item was added:<br>
> > > + ----- Method: InterpreterPrimitives>>primitiveBytecodeSetsAvailable (in<br>
> > > category 'other primitives') -----<br>
> > > + primitiveBytecodeSetsAvailable<br>
> > > +       "Answer the encoder names for the supported bytecode sets."<br>
> > > +       <export: true><br>
> > > +       | encoderNames |<br>
> > > +       argumentCount >0 ifTrue:<br>
> > > +               [^self primitiveFailFor: PrimErrBadNumArgs].<br>
> > > +       encoderNames := self instantiateClass: self classArray<br>
> > > indexableSize: 3.<br>
> > > +       self storePointer: 0 ofObject: encoderNames withValue:<br>
> > > (objectMemory stringForCString: 'EncoderForV3').<br>
> > > +       self storePointer: 1 ofObject: encoderNames withValue:<br>
> > > (objectMemory stringForCString: 'EncoderForV3PlusClosures').<br>
> > > +       self storePointer: 2 ofObject: encoderNames withValue:<br>
> > > (objectMemory stringForCString: 'EncoderForSistaV1').<br>
> > > +       self pop: 1 thenPush: encoderNames.<br>
> > > + !<br>
> > ><br>
> > <br>
> > use self methodReturnValue: encoderNames instead of self pop: 1 thenPush:<br>
> > encoderNames.<br>
> > <br>
> > Item was added:<br>
> > > + ----- Method: InterpreterPrimitives>>primitiveMultipleBytecodeSetsActive<br>
> > > (in category 'other primitives') -----<br>
> > > + primitiveMultipleBytecodeSetsActive<br>
> > > +       "Given one boolean parameter, set multipleBytecodeSetsActive to<br>
> > > inform<br>
> > > +        the VM that alternate bytecode sets such as SistaV1 are now in<br>
> > > use and<br>
> > > +       that the image format number should be updated accordingly. With<br>
> > > zero<br>
> > > +       parameters, answer the current value of<br>
> > > multipleBytecodeSetsActive."<br>
> > > +<br>
> > > +       <export: true><br>
> > > +       argumentCount >1 ifTrue:<br>
> > > +               [^self primitiveFailFor: PrimErrBadNumArgs].<br>
> > > +       argumentCount = 1<br>
> > > +               ifTrue: [self stackTop = objectMemory trueObject<br>
> > > +                       ifTrue: [self cppIf: MULTIPLEBYTECODESETS<br>
> > > +                               ifTrue: [multipleBytecodeSetsActive :=<br>
> > > true]<br>
> > > +                               ifFalse: [^self primitiveFailFor:<br>
> > > PrimErrUnsupported]]<br>
> > > +                       ifFalse: [self stackTop = objectMemory falseObject<br>
> > > +                               ifTrue: [multipleBytecodeSetsActive :=<br>
> > > false]<br>
> > > +                               ifFalse:[^self primitiveFailFor:<br>
> > > PrimErrBadArgument]]].<br>
> > > +       multipleBytecodeSetsActive<br>
> > > +               ifTrue: [self pop: argumentCount + 1 thenPush:<br>
> > > objectMemory trueObject]<br>
> > > +               ifFalse: [self pop: argumentCount + 1 thenPush:<br>
> > > objectMemory falseObject].<br>
> > <br>
> > + !<br>
> > ><br>
> > <br>
> > use self methodReturnBool: multipleBytecodeSetsActive instead of the last<br>
> > three lines.<br>
> > <br>
> > Item was changed:<br>
> > >   InterpreterPrimitives subclass: #StackInterpreter<br>
> > > (excessive size, no diff calculated)<br>
> > ><br>
> > > Item was changed:<br>
> > >   ----- Method: StackInterpreter class>>initializeMiscConstants (in<br>
> > > category 'initialization') -----<br>
> > >   initializeMiscConstants<br>
> > ><br>
> > >         super initializeMiscConstants.<br>
> > >         STACKVM := true.<br>
> > ><br>
> > >         "These flags identify a GC operation (& hence a reason to leak<br>
> > > check),<br>
> > >          or just operations the leak checker can be run for."<br>
> > >         GCModeFull := 1.                                "stop-the-world<br>
> > > global GC"<br>
> > >         GCModeNewSpace := 2.            "Spur's scavenge, or V3's<br>
> > > incremental"<br>
> > >         GCModeIncremental := 4.         "incremental global gc (Dijkstra<br>
> > > tri-colour marking); as yet unimplemented"<br>
> > >         GCModeBecome := 8.                      "v3 post-become<br>
> > > sweeping/Spur forwarding"<br>
> > >         GCCheckImageSegment := 16.      "just a flag for leak checking<br>
> > > image segments"<br>
> > >         GCCheckFreeSpace := 32.         "just a flag for leak checking<br>
> > > free space; Spur only"<br>
> > >         GCCheckShorten := 64.           "just a flag for leak checking<br>
> > > object shortening operations; Spur only"<br>
> > >         GCCheckPrimCall := 128.         "just a flag for leak checking<br>
> > > external primitive calls"<br>
> > ><br>
> > >         StackPageTraceInvalid := -1.<br>
> > >         StackPageUnreached := 0.<br>
> > >         StackPageReachedButUntraced := 1.<br>
> > >         StackPageTraced := 2.<br>
> > ><br>
> > >         DumpStackOnLowSpace := 0.<br>
> > >         MillisecondClockMask := 16r1FFFFFFF.<br>
> > >         "Note: The external primitive table should actually be dynamically<br>
> > > sized but for the sake of inferior platforms (e.g., Mac :-) who cannot<br>
> > > allocate memory in any reasonable way, we keep it static (and cross our<br>
> > > fingers...)"<br>
> > >         MaxExternalPrimitiveTableSize := 4096. "entries"<br>
> > ><br>
> > >         MaxJumpBuf := 32. "max. callback depth"<br>
> > >         FailImbalancedPrimitives := InitializationOptions at:<br>
> > > #FailImbalancedPrimitives ifAbsentPut: [true].<br>
> > >         EnforceAccessControl := InitializationOptions at:<br>
> > > #EnforceAccessControl ifAbsent: [true].<br>
> > ><br>
> > >         ReturnToInterpreter := 1. "setjmp/longjmp code."<br>
> > ><br>
> > >         "Because of a hack with callbacks in the non-threaded VM they must<br>
> > > not conflct with the VM's tag bits."<br>
> > >         DisownVMForFFICall := 16.<br>
> > > +       DisownVMForThreading := 32.<br>
> > > +<br>
> > > +       "The multiple bytecodes active bit in the image format number"<br>
> > > +       MultipleBytecodeSetsBitmask := 512.<br>
> > > -       DisownVMForThreading := 32<br>
> > >   !<br>
> > ><br>
> > > Item was changed:<br>
> > >   ----- Method: StackInterpreter>>readableFormat: (in category 'image<br>
> > > save/restore') -----<br>
> > >   readableFormat: imageVersion<br>
> > >         "Anwer true if images of the given format are readable by this<br>
> > > interpreter.<br>
> > >          Allows a virtual machine to accept selected older image formats."<br>
> > >         <api><br>
> > > +       ^ (self imageFormatVersion = (imageVersion bitAnd: ( -1 -<br>
> > > MultipleBytecodeSetsBitmask))) "Ignore multiple bytecode support identifier"<br>
> > > +               or: [objectMemory hasSpurMemoryManagerAPI not "No<br>
> > > compatibility version for Spur as yet"<br>
> > > -       ^imageVersion = self imageFormatVersion "Float words in<br>
> > > platform-order"<br>
> > > -          or: [objectMemory hasSpurMemoryManagerAPI not "No compatibility<br>
> > > version for Spur as yet"<br>
> > >                         and: [imageVersion = self<br>
> > > imageFormatCompatibilityVersion]] "Float words in BigEndian order"!<br>
> > ><br>
> > <br>
> > Can we write this as<br>
> >     is the image version a Spur version? if so...<br>
> >         insist on exact match<br>
> >     is the image a priori version? If so...<br>
> >         filter the acceptable matches<br>
> >     otherwise<br>
> >         fail for unrecognised version<br>
> > ?<br>
> > <br>
> > 'cuz this way is more readable/commentable/extensible in the long run.<br>
> > <br>
> > Item was changed:<br>
> > >   ----- Method: StackInterpreter>>writeImageFileIO (in category 'image<br>
> > > save/restore') -----<br>
> > >   writeImageFileIO<br>
> > >         "Write the image header and heap contents to imageFile for<br>
> > > snapshot. c.f. writeImageFileIOSimulation.<br>
> > >          The game below is to maintain 64-bit alignment for all<br>
> > > putLong:toFile: occurrences."<br>
> > >         <inline: #never><br>
> > >         | imageName headerStart headerSize f imageBytes bytesWritten<br>
> > > sCWIfn okToWrite |<br>
> > ><br>
> > ...<br>
> > <br>
> > > +       multipleBytecodeSetsActive<br>
> > > +               ifTrue: [self putWord32: (self imageFormatVersion bitOr:<br>
> > > MultipleBytecodeSetsBitmask) toFile: f]<br>
> > > +               ifFalse: [self putWord32: self imageFormatVersion toFile:<br>
> > > f].<br>
> > ><br>
> > <br>
> > why not extract this to e.g. self imageFormatVersionForSnapshot?<br>
> > <br>
> > -       self putWord32: self imageFormatVersion toFile: f.<br>
> > >         self putWord32: headerSize toFile: f.<br>
> > <br>
> > ...<br>
> > <br>
> > _,,,^..^,,,_<br>
> > best, Eliot<br>
> <br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>