Christoph Thiede uploaded a new version of Compiler to project The Trunk: http://source.squeak.org/trunk/Compiler-ct.497.mcz
==================== Summary ====================
Name: Compiler-ct.497 Author: ct Time: 3 March 2024, 7:35:18.153958 pm UUID: 7ee52c4b-be72-c64f-bcb5-0607b502b9b5 Ancestors: Compiler-ct.496
Merges SimulationSideEffectWarning.5.cs (step 1/2): In Context>>doPrimitive:method:receiver:args:, replaces generic "simulation guard" warnings for undebuggable methods by new specific, suppressable SimulationSideEffectWarnings. Also warns when primitive 87 (primitiveResume) is hit. Refactors <primitive: 19> simulation guards into a named alias pragma <simulationGuard>.
Revision: Revise documentation and document emergence and usage of SimulationSideEffectWarning in Context>>runSimulated:.... Fix resumption value of SimulationSideEffectWarning when proceeding from a debugger. Avoid infinite recursion due to process-faithful debugging when debugging a SimulationSideEffectWarning from a debugger. Improves tests.
Step 1/2: Prepare the parser to handle the new <simulationGuard> pragma (as well as unary pragma parsers in general).
Thanks to Marcel (mt) for the advice! See: https://lists.squeakfoundation.org/archives/list/squeak-dev%40lists.squeakfo...
=============== Diff against Compiler-ct.496 ===============
Item was changed: ----- Method: Parser>>pragmaStatement (in category 'pragmas') ----- pragmaStatement "Parse a pragma statement. The leading '<' has already been consumed. The 'here' token is the first one in the pragma. Use that token to dispatch to a custom pragma-parsing method if one can be found with a selector that matches it. Note that custom pragma parsers need to fulfill two requirements: - method selector must match the current token as simple getter, e.g., <apicall: ...> matches #apicall or <primitive: ...> matches #primitive - method must have pragma <pragmaParser> to be called." "0) Early exit" (hereType = #keyword or: [ hereType = #word or: [ hereType = #binary ] ]) ifFalse: [ ^ self expected: 'pragma declaration' ]. + - "1) Do not consider one-word pragmas such as <primitive> and <foobar>. Only keyword pragmas." + "2) Avoid interning new symbols for made-up pragmas such as #my for <my: 1 pragma: 2>." + (Symbol lookup: (here last == $: ifTrue: [here allButLast] ifFalse: [here])) + ifNotNil: [:parserSelector | - here last == $: ifTrue: [ - "2) Avoid interning new symbols for made-up pragmas such as #my for <my: 1 pragma: 2>." - (Symbol lookup: here allButLast) ifNotNil: [:parserSelector | Parser methodDict at: parserSelector ifPresent: [:parserMethod | "3) Only call methods that claim to be a custom pragma parser via <pragmaParser>." (parserMethod hasPragma: #pragmaParser) + ifTrue: [^ self executeMethod: parserMethod]]]. + - ifTrue: [^ self executeMethod: parserMethod]]]]. - "X) No custom pragma parser found. Use the default one." ^ self pragmaStatementKeywords!
Item was added: + ----- Method: Parser>>simulationGuard (in category 'primitives') ----- + simulationGuard + "primitive 19 is a null primitive that always fails. Just a marker for the simulator for methods that are typically undebuggable and could lock your image when simulated." + <pragmaParser> + + self addPragma: (Pragma keyword: #primitive: arguments: #(19)). + + self advance. + ^ true!
Excellent work, Christoph, thanks!
_,,,^..^,,,_ (phone)
On Mar 3, 2024, at 10:35 AM, commits@source.squeak.org wrote:
Christoph Thiede uploaded a new version of Compiler to project The Trunk: http://source.squeak.org/trunk/Compiler-ct.497.mcz
==================== Summary ====================
Name: Compiler-ct.497 Author: ct Time: 3 March 2024, 7:35:18.153958 pm UUID: 7ee52c4b-be72-c64f-bcb5-0607b502b9b5 Ancestors: Compiler-ct.496
Merges SimulationSideEffectWarning.5.cs (step 1/2): In Context>>doPrimitive:method:receiver:args:, replaces generic "simulation guard" warnings for undebuggable methods by new specific, suppressable SimulationSideEffectWarnings. Also warns when primitive 87 (primitiveResume) is hit. Refactors <primitive: 19> simulation guards into a named alias pragma <simulationGuard>.
Revision: Revise documentation and document emergence and usage of SimulationSideEffectWarning in Context>>runSimulated:.... Fix resumption value of SimulationSideEffectWarning when proceeding from a debugger. Avoid infinite recursion due to process-faithful debugging when debugging a SimulationSideEffectWarning from a debugger. Improves tests.
Step 1/2: Prepare the parser to handle the new <simulationGuard> pragma (as well as unary pragma parsers in general).
Thanks to Marcel (mt) for the advice! See: https://lists.squeakfoundation.org/archives/list/squeak-dev%40lists.squeakfo...
=============== Diff against Compiler-ct.496 ===============
Item was changed: ----- Method: Parser>>pragmaStatement (in category 'pragmas') ----- pragmaStatement "Parse a pragma statement. The leading '<' has already been consumed. The 'here' token is the first one in the pragma. Use that token to dispatch to a custom pragma-parsing method if one can be found with a selector that matches it.
Note that custom pragma parsers need to fulfill two requirements: - method selector must match the current token as simple getter, e.g., <apicall: ...> matches #apicall or <primitive: ...> matches #primitive - method must have pragma <pragmaParser> to be called." "0) Early exit" (hereType = #keyword or: [ hereType = #word or: [ hereType = #binary ] ]) ifFalse: [ ^ self expected: 'pragma declaration' ].
- "1) Do not consider one-word pragmas such as <primitive> and <foobar>. Only keyword pragmas."
- "2) Avoid interning new symbols for made-up pragmas such as #my for <my: 1 pragma: 2>."
- (Symbol lookup: (here last == $: ifTrue: [here allButLast] ifFalse: [here]))
ifNotNil: [:parserSelector |
- here last == $: ifTrue: [
"2) Avoid interning new symbols for made-up pragmas such as #my for <my: 1 pragma: 2>."
(Symbol lookup: here allButLast) ifNotNil: [:parserSelector | Parser methodDict at: parserSelector ifPresent: [:parserMethod | "3) Only call methods that claim to be a custom pragma parser via <pragmaParser>." (parserMethod hasPragma: #pragmaParser)
ifTrue: [^ self executeMethod: parserMethod]]].
ifTrue: [^ self executeMethod: parserMethod]]]].
- "X) No custom pragma parser found. Use the default one." ^ self pragmaStatementKeywords!
Item was added:
- ----- Method: Parser>>simulationGuard (in category 'primitives') -----
- simulationGuard
- "primitive 19 is a null primitive that always fails. Just a marker for the simulator for methods that are typically undebuggable and could lock your image when simulated."
<pragmaParser>
- self addPragma: (Pragma keyword: #primitive: arguments: #(19)).
- self advance.
- ^ true!
Glad you like it!
________________________________ From: Eliot Miranda eliot.miranda@gmail.com Sent: Sunday, March 3, 2024 9:53:45 PM To: squeak-dev@lists.squeakfoundation.org squeak-dev@lists.squeakfoundation.org Subject: [squeak-dev] Re: The Trunk: Compiler-ct.497.mcz
Excellent work, Christoph, thanks!
_,,,^..^,,,_ (phone)
On Mar 3, 2024, at 10:35 AM, commits@source.squeak.org wrote:
Christoph Thiede uploaded a new version of Compiler to project The Trunk: http://source.squeak.org/trunk/Compiler-ct.497.mcz
==================== Summary ====================
Name: Compiler-ct.497 Author: ct Time: 3 March 2024, 7:35:18.153958 pm UUID: 7ee52c4b-be72-c64f-bcb5-0607b502b9b5 Ancestors: Compiler-ct.496
Merges SimulationSideEffectWarning.5.cs (step 1/2): In Context>>doPrimitive:method:receiver:args:, replaces generic "simulation guard" warnings for undebuggable methods by new specific, suppressable SimulationSideEffectWarnings. Also warns when primitive 87 (primitiveResume) is hit. Refactors <primitive: 19> simulation guards into a named alias pragma <simulationGuard>.
Revision: Revise documentation and document emergence and usage of SimulationSideEffectWarning in Context>>runSimulated:.... Fix resumption value of SimulationSideEffectWarning when proceeding from a debugger. Avoid infinite recursion due to process-faithful debugging when debugging a SimulationSideEffectWarning from a debugger. Improves tests.
Step 1/2: Prepare the parser to handle the new <simulationGuard> pragma (as well as unary pragma parsers in general).
Thanks to Marcel (mt) for the advice! See: https://lists.squeakfoundation.org/archives/list/squeak-dev%40lists.squeakfo...
=============== Diff against Compiler-ct.496 ===============
Item was changed: ----- Method: Parser>>pragmaStatement (in category 'pragmas') ----- pragmaStatement "Parse a pragma statement. The leading '<' has already been consumed. The 'here' token is the first one in the pragma. Use that token to dispatch to a custom pragma-parsing method if one can be found with a selector that matches it.
Note that custom pragma parsers need to fulfill two requirements: - method selector must match the current token as simple getter, e.g., <apicall: ...> matches #apicall or <primitive: ...> matches #primitive - method must have pragma <pragmaParser> to be called." "0) Early exit" (hereType = #keyword or: [ hereType = #word or: [ hereType = #binary ] ]) ifFalse: [ ^ self expected: 'pragma declaration' ].
- "1) Do not consider one-word pragmas such as <primitive> and <foobar>. Only keyword pragmas."
- "2) Avoid interning new symbols for made-up pragmas such as #my for <my: 1 pragma: 2>."
- (Symbol lookup: (here last == $: ifTrue: [here allButLast] ifFalse: [here]))
ifNotNil: [:parserSelector |
- here last == $: ifTrue: [
"2) Avoid interning new symbols for made-up pragmas such as #my for <my: 1 pragma: 2>."
(Symbol lookup: here allButLast) ifNotNil: [:parserSelector | Parser methodDict at: parserSelector ifPresent: [:parserMethod | "3) Only call methods that claim to be a custom pragma parser via <pragmaParser>." (parserMethod hasPragma: #pragmaParser)
ifTrue: [^ self executeMethod: parserMethod]]].
ifTrue: [^ self executeMethod: parserMethod]]]].
- "X) No custom pragma parser found. Use the default one." ^ self pragmaStatementKeywords!
Item was added:
- ----- Method: Parser>>simulationGuard (in category 'primitives') -----
- simulationGuard
- "primitive 19 is a null primitive that always fails. Just a marker for the simulator for methods that are typically undebuggable and could lock your image when simulated."
<pragmaParser>
- self addPragma: (Pragma keyword: #primitive: arguments: #(19)).
- self advance.
- ^ true!
squeak-dev@lists.squeakfoundation.org