Skip to content

Commit

Permalink
Minor change, less lines in new code in platforms/win32/vm/sqWin32Mai…
Browse files Browse the repository at this point in the history
…n.c.

Minor upgrades to Slang Test Workspace.text
  • Loading branch information
eliotmiranda committed May 9, 2024
1 parent 5e6de00 commit ffa05c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion image/Slang Test Workspace.text
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"Here are some doits to get Slang to generate a single method to the transcript"[Transcript show: [| sel vmm s cg | sel := #scavenge:. vmm := (VMMaker forPlatform: 'Cross') interpreterClass: StackInterpreter; options: #(ObjectMemory Spur64BitCoMemoryManager). cg := [vmm buildCodeGeneratorForInterpreter] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. "to break at inlining decisions or type inferrence uncomment the following. If src & dest are different selectors, breaks on inlining. If src & dest are the same selector, breaks on type inference in sel." "cg breakSrcInlineSelector: sel; breakDestInlineSelector: sel; breakOnInline: false". cg vmClass preGenerationHook: cg. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { sel }. cg prepareMethods. ((sel beginsWith: 'bytecode') or: [sel endsWith: 'Bytecode']) ifTrue: [cg doBasicInlining: true] ifFalse: [cg doInlining: true]. s := ReadWriteStream on: String new. (cg methodNamed: sel) halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| sel vmm s cg | sel := #initializeThreadState"populate:from:to:". vmm := (VMMaker forPlatform: 'Cross') interpreterClass: CoInterpreterMT; options: {ObjectMemory. Spur64BitCoMemoryManager. #Cogit. Cogit chooseCogitClass name}. cg := [vmm buildCodeGeneratorForInterpreter] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. cg vmClass preGenerationHook: cg. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { sel }. cg prepareMethods. ((sel beginsWith: 'bytecode') or: [sel endsWith: 'Bytecode']) ifTrue: [cg doBasicInlining: true] ifFalse: [cg doInlining: true]. s := ReadWriteStream on: String new. (cg methodNamed: sel) halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| sel s vmm cg | sel := #compileEntry. vmm := VMMaker forPlatform: 'Cross'. cg := [vmm interpreterClass: CoInterpreter; options: {#Cogit. Cogit chooseCogitClass name}; buildCodeGeneratorForCogit] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. cg vmClass preGenerationHook: cg. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { #compactCogCompiledCode. sel }. cg prepareMethods. cg doInlining: cg vmClass doInlining. s := ReadWriteStream on: String new. (cg methodNamed: sel) halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| tm s vmm cg | vmm := VMMaker forPlatform: 'Cross'. cg := [vmm interpreterClass: StackInterpreter; buildCodeGeneratorForInterpreter] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. cg vmClass preGenerationHook: cg. tm := (StackInterpreter compile: 'foo self cppIf: ''ARBITRARY'' ifTrue: [self cCode: ''arbi''] ifFalse: [self cCode: ''trary'']. self cppIf: (self cCode: ''ARBITRARY'') ifTrue: [self cCode: ''arbi''] ifFalse: [self cCode: ''trary'']' classified: nil notifying: nil trailer: CompiledMethodTrailer empty ifFail: []) node asTranslationMethodOfClass: cg translationMethodClass. cg addMethod: tm. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { #foo }. cg prepareMethods. cg doInlining: true. s := ReadWriteStream on: String new. (cg methodNamed: #foo) halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| plugin sel s vmm cg | plugin := ThreadedARMFFIPlugin. sel := #primitiveCallout. vmm := VMMaker forPlatform: 'Cross'. cg := [plugin buildCodeGenerator] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. cg breakSrcInlineSelector: #cdigitMontgomery:len:times:len:modulo:len:mInvModB:into:; breakDestInlineSelector: sel; breakOnInline: "false"true. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { sel }. cg prepareMethods. cg doInlining: true. s := ReadWriteStream on: String new. (cg anyMethodNamed: sel) removeUnusedTempsAndNilIfRequiredIn: cg; halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| plugin s cg | plugin := FileCopyPlugin"UnixOSProcessPlugin". cg := plugin buildCodeGenerator. cg inferTypesForImplicitlyTypedVariablesAndMethods. plugin pruneUnusedInterpreterPluginMethodsIn: cg. s := ReadWriteStream on: String new. cg emitCCodeOn: s doInlining: true doAssertions: false. s contents] value].[| cg |cg := BitBltSimulation buildCodeGeneratorUpTo: BitBltSimulation.cg inferTypesForImplicitlyTypedVariablesAndMethods].
"Here are some doits to get Slang to generate a single method to the transcript"CCodeGenerator classPool at: #BreakSrcSelectors put: nil.[Transcript show: [| sel vmm s cg | sel := #scavenge:. vmm := (VMMaker forPlatform: 'Cross') interpreterClass: StackInterpreter; options: #(ObjectMemory Spur64BitCoMemoryManager). cg := [vmm buildCodeGeneratorForInterpreter] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. "to break at inlining decisions or type inferrence uncomment the following. If src & dest are different selectors, breaks on inlining. If src & dest are the same selector, breaks on type inference in sel." "cg breakSrcInlineSelector: sel; breakDestInlineSelector: sel; breakOnInline: false". cg vmClass preGenerationHook: cg. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { sel }. cg prepareMethods. ((sel beginsWith: 'bytecode') or: [sel endsWith: 'Bytecode']) ifTrue: [cg doBasicInlining: true] ifFalse: [cg doInlining: true]. s := ReadWriteStream on: String new. (cg methodNamed: sel) halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| sel vmm s cg | sel := #checkForEventsMayContextSwitch:"populate:from:to:". CCodeGenerator classPool at: #BreakSrcSelectors put: #(checkForEventsMayContextSwitch: checkInvokeIOProcessEvents:). vmm := (VMMaker forPlatform: 'Cross') interpreterClass: CoInterpreterMT; options: #(COGMTVM true ObjectMemory Spur64BitCoMemoryManager MULTIPLEBYTECODESETS true), {#Cogit. Cogit chooseCogitClass name}. cg := [vmm buildCodeGeneratorForInterpreter] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. cg vmClass preGenerationHook: cg. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { sel }. cg prepareMethods. ((sel beginsWith: 'bytecode') or: [sel endsWith: 'Bytecode']) ifTrue: [cg doBasicInlining: true] ifFalse: [cg doInlining: true]. s := ReadWriteStream on: String new. (cg methodNamed: sel) halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| sel s vmm cg | sel := #compileEntry. vmm := VMMaker forPlatform: 'Cross'. cg := [vmm interpreterClass: CoInterpreter; options: {#Cogit. Cogit chooseCogitClass name}; buildCodeGeneratorForCogit] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. cg vmClass preGenerationHook: cg. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { #compactCogCompiledCode. sel }. cg prepareMethods. cg doInlining: cg vmClass doInlining. s := ReadWriteStream on: String new. (cg methodNamed: sel) halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| tm s vmm cg | vmm := VMMaker forPlatform: 'Cross'. cg := [vmm interpreterClass: StackInterpreter; buildCodeGeneratorForInterpreter] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. cg vmClass preGenerationHook: cg. tm := (StackInterpreter compile: 'foo self cppIf: ''ARBITRARY'' ifTrue: [self cCode: ''arbi''] ifFalse: [self cCode: ''trary'']. self cppIf: (self cCode: ''ARBITRARY'') ifTrue: [self cCode: ''arbi''] ifFalse: [self cCode: ''trary'']' classified: nil notifying: nil trailer: CompiledMethodTrailer empty ifFail: []) node asTranslationMethodOfClass: cg translationMethodClass. cg addMethod: tm. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { #foo }. cg prepareMethods. cg doInlining: true. s := ReadWriteStream on: String new. (cg methodNamed: #foo) halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| plugin sel s vmm cg | plugin := "ThreadedARM64FFIPlugin"UnixOSProcessPlugin. sel := #"primitiveCallout"setSignalNumber:handler:. vmm := VMMaker forPlatform: 'Cross'. cg := [plugin buildCodeGenerator] on: Notification do: [:ex| ex tag == #getVMMaker ifTrue: [ex resume: vmm] ifFalse: [ex pass]]. cg breakSrcInlineSelector: #cdigitMontgomery:len:times:len:modulo:len:mInvModB:into:; breakDestInlineSelector: sel; breakOnInline: "false"true. cg inferTypesForImplicitlyTypedVariablesAndMethods. cg retainMethods: { sel }. cg prepareMethods. cg doInlining: true. s := ReadWriteStream on: String new. (cg anyMethodNamed: sel) removeUnusedTempsAndNilIfRequiredIn: cg; halt; emitCCodeOn: s generator: cg. s contents] value].[Transcript show: [| plugin s cg | plugin := FileCopyPlugin"UnixOSProcessPlugin". cg := plugin buildCodeGenerator. cg inferTypesForImplicitlyTypedVariablesAndMethods. plugin pruneUnusedInterpreterPluginMethodsIn: cg. s := ReadWriteStream on: String new. cg emitCCodeOn: s doInlining: true doAssertions: false. s contents] value].[| cg |cg := BitBltSimulation buildCodeGeneratorUpTo: BitBltSimulation.cg inferTypesForImplicitlyTypedVariablesAndMethods].
Expand Down
10 changes: 4 additions & 6 deletions platforms/win32/vm/sqWin32Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ sqMain(int argc, char *argv[])

/* if headless running is requested, try to to create an icon
in the Win95/NT system tray */
if(fHeadlessImage && !fRunService)
if (fHeadlessImage && !fRunService)
SetSystemTrayIcon(1);

/* read the image file */
Expand All @@ -1735,12 +1735,10 @@ sqMain(int argc, char *argv[])
readImageFromFileHeapSizeStartingAt(imageFile, virtualMemory, 0);
}
else {
if (imageFile == ImageIsAResource) {
int i;
for (i = strlen(imageResourceName); i >= 0; --i)
if (imageFile == ImageIsAResource)
for (int i = strlen(imageResourceName); i >= 0; --i)
imageNameW[i] = imageName[i] = imageResourceName[i];
}


readImageFromFileHeapSizeStartingAt(imageFile, virtualMemory, sqImageFilePosition(imageFile));
}
sqImageFileClose(imageFile);
Expand Down

0 comments on commit ffa05c2

Please sign in to comment.