Skip to content

Commit 7a699e1

Browse files
committed
Reworks the updating / removal of instrumented methods
1 parent 179e30b commit 7a699e1

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
*Babylonian-Compiler
2+
addAndClassifySelector: selector withMethod: compiledMethod inProtocol: category notifying: requestor
3+
4+
"This is an abomination of the Squeak Kernel code, ContextS2 code, and Babylonian Code"
5+
| priorMethodOrNil |
6+
(compiledMethod isCompiledMethod or: [
7+
(compiledMethod respondsTo: #isBase) and: [compiledMethod isBase]]) ifTrue: [
8+
9+
"--- START OF COPIED CODE FROM SQUEAK KERNEL ---"
10+
priorMethodOrNil := self compiledMethodAt: selector ifAbsent: [nil].
11+
self addSelectorSilently: selector withMethod: compiledMethod.
12+
SystemChangeNotifier uniqueInstance
13+
doSilently: [self organization classify: selector under: category].
14+
priorMethodOrNil isNil
15+
ifTrue: [SystemChangeNotifier uniqueInstance methodAdded: compiledMethod selector: selector inProtocol: category class: self requestor: requestor]
16+
ifFalse: [SystemChangeNotifier uniqueInstance methodChangedFrom: priorMethodOrNil to: compiledMethod selector: selector inClass: self requestor: requestor].
17+
"--- END OF COPIED CODE FROM SQUEAK KERNEL ---"
18+
19+
"--- Babylonian code ---"
20+
self updateAndRemoveBPMethods: selector.
21+
"--- END OF Babylonian code ---"
22+
23+
] ifFalse: ["dealing with a partial layer method"
24+
priorMethodOrNil := self layeredMethodDict at: compiledMethod asSymbol ifAbsent: [nil].
25+
self addSelectorSilently: selector withMethod: compiledMethod.
26+
SystemChangeNotifier uniqueInstance
27+
doSilently: [self organization classify: compiledMethod asSymbol under: category].
28+
priorMethodOrNil
29+
ifNil: [SystemChangeNotifier uniqueInstance
30+
methodAdded: compiledMethod method selector: compiledMethod asSymbol
31+
inProtocol: category class: self requestor: requestor]
32+
ifNotNil: [SystemChangeNotifier uniqueInstance
33+
methodChangedFrom: (priorMethodOrNil ifNotNil: [:pm | pm method]) to: compiledMethod method
34+
selector: compiledMethod asSymbol inClass: self requestor: requestor].
35+
].

packages/Babylonian-Compiler.package/ClassDescription.extension/instance/noteCompilationOf.meta..st renamed to packages/Babylonian-Compiler.package/ClassDescription.extension/instance/updateAndRemoveBPMethods..st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
*Babylonian-Compiler
2-
noteCompilationOf: aSelector meta: isMeta
2+
updateAndRemoveBPMethods: aSelector
33

44
| theClass method methodHasInstalledInstrumentation sourceIsNotInstrumented |
5-
theClass := isMeta ifTrue: [self class] ifFalse: [self].
6-
method := theClass>>aSelector.
5+
theClass := self.
6+
method := theClass>>aSelector.
77

88
sourceIsNotInstrumented := (BPCompiler new methodSourceRequiresBPLayers: method getSource) not.
99
methodHasInstalledInstrumentation := method isContextSMethod and: [method isLayered and: [method allInvolvedLayers = #(bpInstrumented)]].

packages/Babylonian-Compiler.package/ClassDescription.extension/methodProperties.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
"class" : {
33
},
44
"instance" : {
5-
"noteCompilationOf:meta:" : "pre 10/9/2020 11:03" } }
5+
"addAndClassifySelector:withMethod:inProtocol:notifying:" : "pre 10/12/2020 17:00",
6+
"updateAndRemoveBPMethods:" : "pre 10/12/2020 16:41" } }

0 commit comments

Comments
 (0)