Last active
February 29, 2016 12:25
-
-
Save guillep/9bc9543404b34d49408d to your computer and use it in GitHub Desktop.
VM Simulator Scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sim | | |
InterpreterStackPages initialize. | |
StackInterpreterSimulator initializeWithOptions: Dictionary new. | |
sim := StackInterpreterSimulator new. | |
sim openOn: 'pharo4/Pharo.image'. | |
sim openAsMorph. | |
sim initStackPages. | |
sim loadInitialContext. | |
sim internalizeIPandSP. | |
sim fetchNextBytecode. | |
10000000 timesRepeat: [ sim singleStep ]. | |
[sim run] fork. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vm := StackInterpreterSimulator newWithOptions: #(#ObjectMemory #Spur32BitMemoryManager ). | |
om := vm objectMemory. | |
vm desiredNumStackPages: 8. "Makes simulation faster by creating fewer stack pages." | |
vm openOn: Smalltalk imagePath. | |
vm instVarNamed: 'assertVEPAES' put: false. "This makes the simulation faster by turning off some expensive asserts" | |
vm openAsMorph | |
[[vm runForNBytes: 1500000] | |
on: Halt , ProvideAnswerNotification "This exception handler ignores some halts and confirmers occurring during simulation" | |
do: [:ex | | |
ex messageText == #primitiveExecuteMethodArgsArray | |
ifTrue: [ex resume]. | |
ex messageText = 'clear transcript?' | |
ifTrue: [ex resume: false]. | |
ex pass]] ensure: [Display restore]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment