From c6958566a888705ce39c0f5d897b63d69678e031 Mon Sep 17 00:00:00 2001 From: Leon Matthes Date: Sun, 18 Jun 2023 11:45:28 +0200 Subject: [PATCH 1/2] Update Github links in getGoodSpur64VM.sh Github now seems to lazy-load the list of downloadable files, so we can't get the download links from the HTML directly. It seems there is now a stable download URL available though, which we can just use directly. --- image/getGoodSpur64VM.sh | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/image/getGoodSpur64VM.sh b/image/getGoodSpur64VM.sh index 4433c8beb5..7549838fdf 100755 --- a/image/getGoodSpur64VM.sh +++ b/image/getGoodSpur64VM.sh @@ -4,6 +4,9 @@ set +v . ./envvars.sh +RELEASES_URL="https://github.com/OpenSmalltalk/opensmalltalk-vm/releases" +LATEST_RELEASE_URL="$RELEASES_URL/latest" + for foo in once; do # allow break to jump to end of script if [ "$1" = -vm -a -n "$2" -a -x "`which "$2"`" ]; then @@ -37,32 +40,32 @@ else echo "If you've built your own VM you can substitute that using the -vm myvm argument to this script." 1>&2 exit 1 esac - echo checking for latest 64-bit VM on github.com/OpenSmalltalk/opensmalltalk-vm/releases/latest - curl -s -L "https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/latest" >.LATEST.html + echo checking for latest 64-bit VM on $LATEST_RELEASE_URL + curl -s -L "$LATEST_RELEASE_URL" >.LATEST.html RELEASE="`grep 'Release [0-9][0-9]* .*</title' .LATEST.html | sed 's/^.*Release \([0-9][0-9]*\) .*$/\1/'`" + if [ -z "$RELEASE" ]; then + echo "cannot find latest release on $LATEST_RELEASE_URL" 1>&2 + echo "If you've built your own VM you can substitute that using the -vm myvm argument to this script." 1>&2 + exit 1 + fi if [ -f $LATESTFILE -a "`cat $LATESTFILE`" = $RELEASE -a -x $VM ]; then echo latest 64-bit VM on $OS for $CPU is $VM test "$1" = "-verbose" && $VM -version break fi - URL="`curl -s -L "https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/latest" | grep "href=.*$LATESTVM" | sed -e 's|^[^"]*"|https://github.com/|' -e 's|".*$||'`" - echo $URL - if [ -z "$URL" ]; then - echo "cannot find latest release on https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/latest" 1>&2 - echo "If you've built your own VM you can substitute that using the -vm myvm argument to this script." 1>&2 - exit 1 - fi - echo Downloading $LATESTVM from $URL + DOWNLOAD_URL="$RELEASES_URL/download/${RELEASE}/${LATESTVM}" + echo $DOWNLOAD_URL + echo Downloading $LATESTVM from $DOWNLOAD_URL if [ "$1" = -test ]; then test -n "$VOLUME" && echo "VOLUME=$VOLUME" echo "VMDIR=$VMDIR" echo "VM=$VM" echo "LATESTVM=$LATESTVM" - echo "URL=$URL" - echo curl -L "$URL" -o "$LATESTVM" + echo "DOWNLOAD_URL=$DOWNLOAD_URL" + echo curl -L "$DOWNLOAD_URL" -o "$LATESTVM" exit fi - curl -L "$URL" -o "$LATESTVM" + curl -L "$DOWNLOAD_URL" -o "$LATESTVM" case $OS in Darwin) if open $LATESTVM; then @@ -75,7 +78,7 @@ else if [[ $(file "$LATESTVM" | grep 'gzip compressed data') ]]; then tar xzf "$LATESTVM" else - echo No gzip data at "$URL" + echo No gzip data at "$DOWNLOAD_URL" exit 1 fi;; esac From fd93b45b80ef51e4c5fd9daf6512edbf710327c4 Mon Sep 17 00:00:00 2001 From: Leon Matthes <leon@matthes.biz> Date: Sun, 18 Jun 2023 11:59:27 +0200 Subject: [PATCH 2/2] VMMaker: Reorder VM Simulation Workspace I suspect the default nowadays is a 64-bit VM, so order this to the top. As a new user, I accidentally tried running the 32-bit Simulation, which ended up not working as I had only built the 64-bit Bochs plugin. --- image/VM Simulation Workspace.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/VM Simulation Workspace.text b/image/VM Simulation Workspace.text index 348fd84e45..daecd8ad73 100644 --- a/image/VM Simulation Workspace.text +++ b/image/VM Simulation Workspace.text @@ -1 +1 @@ -"To build the spurreader or spurreader-64 images used in the examples below run one of buildspurtrunkreaderimage.sh buildspurtrunkreader64image.sh The reader images include a simple REPL loop that reads a chunk-format expression from stdin, evaluates it and writes the printString of the result to stdout. In the simulator you are prompted for input via an input widget and writes output to the Transcript. e.g. try 3+4!. On the Transcript you should see squeak> 7 squeak> " "Run the Cog VM simulator on a Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)" [| cos | cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" ObjectMemory Spur32BitCoMemoryManager MULTIPLEBYTECODESETS true), {#ISA. Cogit choose32BitISA}. "cos initializeThreadSupport." cos desiredNumStackPages: 8. "Speeds up scavenging when simulating. Set to e.g. 64 for something like the real VM." cos openOn: 'spurreader.image'. cos openAsMorph; run]. "Run the Stack VM simulator on a Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)" [| sis | sis := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager MULTIPLEBYTECODESETS true). sis desiredNumStackPages: 8. "Speeds up scavenging when simulating. Set to e.g. 64 for something like the real VM." sis assertValidExecutionPointersAtEachStep: false. "Set this to true to turn on an expensive assert that checks for valid stack, frame pointers etc on each bytecode. Useful when you're adding new bytecodes or exotic execution primitives." sis openOn: 'spurreader.image'. sis openAsMorph; run]. "Run the Cog VM simulator on a Cog image (by default the Squeak 4.5 image:). Note the plethora of optional debug features in comments." [| cos proc opts | cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" MULTIPLEBYTECODESETS true), {#ISA. Cogit choose32BitISA}. "cos initializeThreadSupport." cos desiredNumStackPages: 8. cos openOn: 'Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image'. false ifTrue: [cos systemAttributes at: 2 put: '-doit'; at: 3 put: 'ShootoutTests runAllToTranscript. Smalltalk quitPrimitive']. "cos cogit breakPC: 16r2697." "cos cogit traceStores: true." "cos cogit sendTrace: 6." "trace prims & print" "cos cogit singleStep: true." "cos cogit printInstructions: true." "cos linkSends: false." "cos enableCog: false." "cos setBreakSelector: 'standardIOStreamNamed:forWrite:'." "cos cogit setBreakMethod: 16rCE1630." "cos cogit cog: 16rAB0B28 + cos startOfMemory selector: 16r31F280 + cos startOfMemory." "e.g. jit a specific method without simulating" cos openAsMorph; run]. "Run the Stack VM simulator on a 64-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)" [| sis | sis := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur64BitMemoryManager MULTIPLEBYTECODESETS true). sis desiredNumStackPages: 8. sis assertValidExecutionPointersAtEachStep: false. "Set this to true to turn on an expensive assert that checks for valid stack, frame pointers etc on each bytecode. Useful when you're adding new bytecodes or exotic execution primitives." sis openOn: 'spurreader-64.image'. sis openAsMorph; run]. "Run the Cog VM simulator on a 64-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)" [| cos | cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" ObjectMemory Spur64BitCoMemoryManager MULTIPLEBYTECODESETS true), {#ISA. Cogit choose64BitISA}. "cos initializeThreadSupport." cos desiredNumStackPages: 8. cos openOn: 'spurreader-64.image'. cos openAsMorph; run] \ No newline at end of file +"To build the spurreader or spurreader-64 images used in the examples below run one of buildspurtrunkreaderimage.sh buildspurtrunkreader64image.sh The reader images include a simple REPL loop that reads a chunk-format expression from stdin, evaluates it and writes the printString of the result to stdout. In the simulator you are prompted for input via an input widget and writes output to the Transcript. e.g. try 3+4!. On the Transcript you should see squeak> 7 squeak> " "Run the Cog VM simulator on a 64-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)" [| cos | cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" ObjectMemory Spur64BitCoMemoryManager MULTIPLEBYTECODESETS true), {#ISA. Cogit choose64BitISA}. "cos initializeThreadSupport." cos desiredNumStackPages: 8. cos openOn: 'spurreader-64.image'. cos openAsMorph; run]. "Run the Stack VM simulator on a 64-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)" [| sis | sis := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur64BitMemoryManager MULTIPLEBYTECODESETS true). sis desiredNumStackPages: 8. sis assertValidExecutionPointersAtEachStep: false. "Set this to true to turn on an expensive assert that checks for valid stack, frame pointers etc on each bytecode. Useful when you're adding new bytecodes or exotic execution primitives." sis openOn: 'spurreader-64.image'. sis openAsMorph; run]. "Run the Cog VM simulator on a 32-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)" [| cos | cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" ObjectMemory Spur32BitCoMemoryManager MULTIPLEBYTECODESETS true), {#ISA. Cogit choose32BitISA}. "cos initializeThreadSupport." cos desiredNumStackPages: 8. "Speeds up scavenging when simulating. Set to e.g. 64 for something like the real VM." cos openOn: 'spurreader.image'. cos openAsMorph; run]. "Run the Stack VM simulator on a 32-bit Spur image (by default the Spur trunk 4.6 image, complex options are in the Cog example below)" [| sis | sis := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager MULTIPLEBYTECODESETS true). sis desiredNumStackPages: 8. "Speeds up scavenging when simulating. Set to e.g. 64 for something like the real VM." sis assertValidExecutionPointersAtEachStep: false. "Set this to true to turn on an expensive assert that checks for valid stack, frame pointers etc on each bytecode. Useful when you're adding new bytecodes or exotic execution primitives." sis openOn: 'spurreader.image'. sis openAsMorph; run]. "Run the Cog VM simulator on a 32-bit Cog image (by default the Squeak 4.5 image:). Note the plethora of optional debug features in comments." [| cos proc opts | cos := CogVMSimulator newWithOptions: #(Cogit StackToRegisterMappingCogit "SimpleStackBasedCogit" MULTIPLEBYTECODESETS true), {#ISA. Cogit choose32BitISA}. "cos initializeThreadSupport." cos desiredNumStackPages: 8. cos openOn: 'Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image'. false ifTrue: [cos systemAttributes at: 2 put: '-doit'; at: 3 put: 'ShootoutTests runAllToTranscript. Smalltalk quitPrimitive']. "cos cogit breakPC: 16r2697." "cos cogit traceStores: true." "cos cogit sendTrace: 6." "trace prims & print" "cos cogit singleStep: true." "cos cogit printInstructions: true." "cos linkSends: false." "cos enableCog: false." "cos setBreakSelector: 'standardIOStreamNamed:forWrite:'." "cos cogit setBreakMethod: 16rCE1630." "cos cogit cog: 16rAB0B28 + cos startOfMemory selector: 16r31F280 + cos startOfMemory." "e.g. jit a specific method without simulating" cos openAsMorph; run]. \ No newline at end of file