From 50408689144c11d60d762770ebbcfc5484876b14 Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Fri, 9 Sep 2022 11:06:40 +0200 Subject: [PATCH 1/3] Fixing baseline dependencies by adding espell and removing SpecDebugger --- ...aselineOfDebuggableASTInterpreter.class.st | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st index 442f871..ca472d5 100644 --- a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st +++ b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st @@ -8,27 +8,28 @@ Class { BaselineOfDebuggableASTInterpreter >> baseline: spec [ - spec - for: #common - do: [ - "Dependencies" - spec - baseline: 'SpecDebugger' - with: [ spec repository: 'github://dupriezt/Spec-Debugger' ]. - spec - baseline: 'Ghost' - with: [ spec repository: 'gitlab://gitlab.inria.fr:RMOD/Ghost' ]. - - "Packages" - spec - package: 'DebuggableASTInterpreter'; - package: 'DebuggableASTDebugger' with: [ spec requires: #('DebuggableASTInterpreter' 'SpecDebugger') ]; - package: 'DebuggableASTInterpreterOverlays' with: [ spec requires: #('DebuggableASTDebugger' 'Ghost') ]]. + spec for: #common do: [ "Dependencies" + spec + baseline: 'Espell2' + with: [ spec repository: 'github://carolahp/Espell2' ]. + spec + baseline: 'Ghost' + with: [ spec repository: 'gitlab://gitlab.inria.fr:RMOD/Ghost' ]. + + "Packages" + spec + package: 'DebuggableASTInterpreter' + with: [ spec requires: #( 'Espell2' ) ]; + package: 'DebuggableASTDebugger' + with: [ spec requires: #( 'DebuggableASTInterpreter' ) ]; + package: 'DebuggableASTInterpreterOverlays' + with: [ spec requires: #( 'DebuggableASTDebugger' + 'Ghost' ) ] ]. - "Groups" - spec - group: 'default' with: #('Model'); - group: 'Model' with: #('DebuggableASTInterpreter'); - group: 'Debugger' with: #('DebuggableASTDebugger'); - group: 'Overlay' with: #('DebuggableASTInterpreterOverlays') + "Groups" + spec + group: 'default' with: #( 'Model' ); + group: 'Model' with: #( 'DebuggableASTInterpreter' ); + group: 'Debugger' with: #( 'DebuggableASTDebugger' ); + group: 'Overlay' with: #( 'DebuggableASTInterpreterOverlays' ) ] From 6831d986df66ee14b006315d752fd00b350d5b9d Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Fri, 9 Sep 2022 14:35:40 +0200 Subject: [PATCH 2/3] Fixing baseline by removing Espell and SpecDebugger dependencies --- ...aselineOfDebuggableASTInterpreter.class.st | 10 +- .../DASTEyeContextInspector.class.st | 29 --- .../DASTSpecDebugger.class.st | 125 ------------ .../DASTSpecDebuggerStack.class.st | 29 --- .../DASTEvaluator.class.st | 178 ------------------ 5 files changed, 3 insertions(+), 368 deletions(-) delete mode 100644 DebuggableASTDebugger/DASTEyeContextInspector.class.st delete mode 100644 DebuggableASTDebugger/DASTSpecDebugger.class.st delete mode 100644 DebuggableASTDebugger/DASTSpecDebuggerStack.class.st delete mode 100644 DebuggableASTInterpreter/DASTEvaluator.class.st diff --git a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st index ca472d5..126d9e6 100644 --- a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st +++ b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st @@ -9,19 +9,15 @@ BaselineOfDebuggableASTInterpreter >> baseline: spec [ spec for: #common do: [ "Dependencies" - spec - baseline: 'Espell2' - with: [ spec repository: 'github://carolahp/Espell2' ]. spec baseline: 'Ghost' with: [ spec repository: 'gitlab://gitlab.inria.fr:RMOD/Ghost' ]. "Packages" spec - package: 'DebuggableASTInterpreter' - with: [ spec requires: #( 'Espell2' ) ]; - package: 'DebuggableASTDebugger' - with: [ spec requires: #( 'DebuggableASTInterpreter' ) ]; + package: 'DebuggableASTInterpreter'; + package: 'DebuggableASTDebugger' with: [ + spec requires: #( 'DebuggableASTInterpreter' ) ]; package: 'DebuggableASTInterpreterOverlays' with: [ spec requires: #( 'DebuggableASTDebugger' 'Ghost' ) ] ]. diff --git a/DebuggableASTDebugger/DASTEyeContextInspector.class.st b/DebuggableASTDebugger/DASTEyeContextInspector.class.st deleted file mode 100644 index f7d778e..0000000 --- a/DebuggableASTDebugger/DASTEyeContextInspector.class.st +++ /dev/null @@ -1,29 +0,0 @@ -" -Reimplementation of the spec context inspector for debugging model compatibility. Should not exist if debugging model APIs were unified. - -Also that current form might disappear or change with SPEC 2. -" -Class { - #name : #DASTEyeContextInspector, - #superclass : #EyeDebuggerContextInspector, - #category : #DebuggableASTDebugger -} - -{ #category : #list } -DASTEyeContextInspector >> addSpecialFields: elements [ - self object variablesDict - keysAndValuesDo: [ :name :value | - elements - add: (DynamicEyeElement host: self object label: name value: value) ] -] - -{ #category : #list } -DASTEyeContextInspector >> addStackTop: elements [ - - elements - add: - (DynamicEyeElement - host: self object - label: 'stackTop' - value: [self object top]) -] diff --git a/DebuggableASTDebugger/DASTSpecDebugger.class.st b/DebuggableASTDebugger/DASTSpecDebugger.class.st deleted file mode 100644 index a05ea71..0000000 --- a/DebuggableASTDebugger/DASTSpecDebugger.class.st +++ /dev/null @@ -1,125 +0,0 @@ -" -Experimental debugger for the DASTInterpreter, based on the spec debugger. - -Code modificaiton from the debugger is not yet possible. -" -Class { - #name : #DASTSpecDebugger, - #superclass : #SpecDebugger, - #category : #DebuggableASTDebugger -} - -{ #category : #specs } -DASTSpecDebugger class >> defaultSpec [ - ^ SpecLayout composed - newColumn: [ :col | - col - add: #stack; - add: #toolbar height: self toolbarHeight. - col - addSplitter; - add: #code; - addSplitter; - newRow: [ :row | - row - add: #receiverInspector; - add: #contextInspector ] ] -] - -{ #category : #initialization } -DASTSpecDebugger >> initializeWidgets [ - stack := self instantiate: self stackPresenterClass. - toolbar := self instantiate: SpecDebuggerDynamicToolbar. - code := self newCode. - receiverInspector := self instantiate: InspectorNavigator. - - contextInspector := self instantiate: DASTEyeContextInspector. - self code - acceptBlock: [ :text :notifyer | - self - recompileMethodTo: text string - inContext: self stack selectedItem - notifying: notifyer ]. - self code whenBuiltDo: [ :ann | ann widget font: self codeFont ] -] - -{ #category : #accessing } -DASTSpecDebugger >> session: aSession [ - super session: aSession. - "receiverInspector interpreter: aSession interpreter." -] - -{ #category : #accessing } -DASTSpecDebugger >> stackPresenterClass [ - ^DASTSpecDebuggerStack -] - -{ #category : #updating } -DASTSpecDebugger >> updateCodeFromContext: aContext [ - | selectionInterval | - selectionInterval := self session - selectedCodeRangeForContext: aContext. - self code - aboutToStyle: true; - text: aContext methodOrBlock source; - doItReceiver: aContext receiver; - doItContext: aContext; - behavior: aContext receiver class; - setSelection: selectionInterval; - highlightNextIntructionInterval: selectionInterval -] - -{ #category : #updating } -DASTSpecDebugger >> updateContextInspectorFromContext: aContext [ - | oldSelection newSelectionIndex | - - oldSelection := contextInspector list selectedItem. - - contextInspector inspect: aContext. - - newSelectionIndex := 1. - oldSelection ifNotNil: - [ contextInspector list listItems withIndexDo: - [ :item :index | item label = oldSelection label ifTrue: [ newSelectionIndex := index ] ]. - ]. - contextInspector list setSelectedIndex: newSelectionIndex. - -] - -{ #category : #updating } -DASTSpecDebugger >> updateReceiverInspectorFromContext: aContext [ - | receiver oldSelection newSelectionIndex | - - oldSelection := receiverInspector inspector ifNotNil: [ :inspector | inspector list selectedItem ]. - - receiver := aContext ifNotNil: [ aContext receiver ]. - receiverInspector inspect: receiver. -" receiverInspector model: (StInspectorModel on: receiver). " - - newSelectionIndex := 1. - oldSelection ifNotNil: - [ receiverInspector inspector list listItems withIndexDo: - [ :item :index | item label = oldSelection label ifTrue: [ newSelectionIndex := index ] ]. - ]. - receiverInspector inspector list setSelectedIndex: newSelectionIndex. - - -] - -{ #category : #'updating actions' } -DASTSpecDebugger >> updateStep [ - super updateStep. - contextInspector generateElements -] - -{ #category : #updating } -DASTSpecDebugger >> updateToolbar [ - - self toolbar update. -] - -{ #category : #updating } -DASTSpecDebugger >> updateToolbarFromSession: aSession [ - - self toolbar session: aSession. -] diff --git a/DebuggableASTDebugger/DASTSpecDebuggerStack.class.st b/DebuggableASTDebugger/DASTSpecDebuggerStack.class.st deleted file mode 100644 index c57c355..0000000 --- a/DebuggableASTDebugger/DASTSpecDebuggerStack.class.st +++ /dev/null @@ -1,29 +0,0 @@ -" -Reimplementation of the spec debugger stack for debugging model compatibility. Should not exist if debugging model APIs were unified. -" -Class { - #name : #DASTSpecDebuggerStack, - #superclass : #SpecDebuggerStack, - #category : #DebuggableASTDebugger -} - -{ #category : #printing } -DASTSpecDebuggerStack >> columnsFor: context [ - "protocol: printing" - - "Answer the array of contexts." - - | method classLocation receiverClass | - method := context methodOrBlock. - classLocation := method methodClass. - receiverClass := context receiver class. - - "If the receiver is differen from the implementor, show the original method implementor" - classLocation := classLocation = receiverClass - ifTrue: [ classLocation name ] - ifFalse: [ receiverClass name , '(' , classLocation name , ')' ]. - context isBlockContext - ifTrue: [ classLocation := '[...] in ' , classLocation ]. - ^ {classLocation. - method selector asString} -] diff --git a/DebuggableASTInterpreter/DASTEvaluator.class.st b/DebuggableASTInterpreter/DASTEvaluator.class.st deleted file mode 100644 index b54c369..0000000 --- a/DebuggableASTInterpreter/DASTEvaluator.class.st +++ /dev/null @@ -1,178 +0,0 @@ -Class { - #name : #DASTEvaluator, - #superclass : #EPASTEvaluator, - #instVars : [ - 'interpreter' - ], - #category : #'DebuggableASTInterpreter-Espell' -} - -{ #category : #'variables-class' } -DASTEvaluator >> assignClassVariable: name inObject: anObject value: value [ - | rgClass | - - (self findClassVariable: name inObject: anObject) ifNotNil: [ - :var | - var value: value. ^ true - "| rDictionary | - rDictionary := EPRemoteDictionary on: anObject basicClass classPool. - rDictionary at: name put: value " - ]. - - ^ false -] - -{ #category : #'variables-instance' } -DASTEvaluator >> assignInstanceVariable: name inObject: anObject value: value [ - | rgClass | - rgClass := anObject basicClass asRGClass. - (rgClass allInstVarNames includes: name) - ifTrue: [ |ivIndex| - ivIndex := rgClass instVarIndexFor: name ifAbsent: [ self halt ]. - anObject instanceVariableAtIndex: ivIndex put: value. - ^ true]. - ^ false -] - -{ #category : #accessing } -DASTEvaluator >> astCache [ - ^ astCache -] - -{ #category : #encoding } -DASTEvaluator >> blockFrom: aDASTBlock [ - ^ (self objectSpace backend mirrorOnExternalHandle: aDASTBlock) asDASTBlockMirror -] - -{ #category : #interpreting } -DASTEvaluator >> evaluateAST: ast [ - - ^ self evaluateAST: ast withTemps: #() -] - -{ #category : #interpreting } -DASTEvaluator >> evaluateCode: someCode withTemps: aCollectionOfTemps [ - - ^self evaluateAST: (self parse: someCode) withTemps: aCollectionOfTemps -] - -{ #category : #primitives } -DASTEvaluator >> executePrimitiveMethod: aDASTMethod withReceiver: anEPMirror withArguments: aCollection [ - ^ anEPMirror executePrimitiveMethod: aDASTMethod withArguments: aCollection asArray -] - -{ #category : #'variables-class' } -DASTEvaluator >> findClassVariable: aString inObject: anObject [ - | mClass hlClass | - mClass := anObject isClassMirror - ifTrue: [ anObject asClassMirror ] - ifFalse: [ anObject basicClass ]. - hlClass := mClass asRemoteClassOnEnvironment: (EPRemoteEnvironment on: self environment bootstrapEnvironment). - - ^ hlClass innerBindingOf: aString. -] - -{ #category : #'variables-class' } -DASTEvaluator >> findClassVariable: aName inObjectAndItsParents: anObject [ - | mobjclass hobjclass hobjparent | - - mobjclass := anObject isClassMirror - ifTrue: [ anObject asClassMirror ] - ifFalse: [ anObject basicClass ]. - hobjclass := mobjclass asRemoteClassOnEnvironment: (EPRemoteEnvironment on: self environment bootstrapEnvironment). - - hobjparent := hobjclass. - [ hobjparent isNilObject ] whileFalse: [ - (hobjparent innerBindingOf: aName) ifNotNil: [:assoc | ^ assoc]. - hobjparent := hobjparent superclass. - ]. - ^ nil - -] - -{ #category : #'variables-global' } -DASTEvaluator >> findGlobalVariable: aString [ - ^(self environment bindingOf: aString) - ifNil: [ self error: 'Variable ', aString , ' not defined!' ] -] - -{ #category : #'variables-instance' } -DASTEvaluator >> findInstanceVariable: aName inObject: anObject [ - | rgClass | - self flag: 'incomplete return value'. - - rgClass := anObject basicClass asRGClass. - rgClass ifNil: [ ^ nil ]. - (rgClass allInstVarNames includes: aName) - ifTrue: [ |ivIndex| - ivIndex := rgClass instVarIndexFor: aName ifAbsent: [ self halt ]. - ^ anObject instanceVariableAtIndex: ivIndex ]. - ^ nil -] - -{ #category : #interpreting } -DASTEvaluator >> initialize [ - - super initialize. - interpreterClass := DASTInterpreter. - astCache := IdentityDictionary new. - -] - -{ #category : #accessing } -DASTEvaluator >> interpreter [ - ^ interpreter ifNil: [ self newInterpreter ] -] - -{ #category : #testing } -DASTEvaluator >> isEPDASTBlockMirror: anEPMirror [ - ^ anEPMirror isEPDASTBlockMirror -] - -{ #category : #encoding } -DASTEvaluator >> literalFrom: anObject [ - ^ anObject asLiteralInObjectSpace: self objectSpace -] - -{ #category : #encoding } -DASTEvaluator >> newArrayWithAll: aCollection [ - ^ self objectSpace newArrayWithAll: aCollection -] - -{ #category : #accessing } -DASTEvaluator >> newInterpreter [ - ^ interpreter := super newInterpreter - -] - -{ #category : #accessing } -DASTEvaluator >> nilObject [ - ^ objectSpace backend nilObject -] - -{ #category : #parsing } -DASTEvaluator >> parse: aString [ - | expression | - - expression := RBParser parseExpression: aString. - (expression isSequence and: [ environment classLoader isClassDefinition: aString ]) - ifTrue: [ expression := EPASTClassDefinition fromMessageNode: expression ]. - (expression isMessage and: [ self isTraitDefinitionSelector: expression selector ]) - ifTrue: [ expression := EPASTTraitDefinition fromMessageNode: expression ]. - ^ expression -] - -{ #category : #testing } -DASTEvaluator >> primitiveResultIsError: anEPPrimitiveResult [ - ^ anEPPrimitiveResult hasFailed -] - -{ #category : #'access primitives' } -DASTEvaluator >> primitiveResultValue: anEPPrimitiveResult [ - ^ anEPPrimitiveResult value -] - -{ #category : #decoding } -DASTEvaluator >> valueOf: anEPMirror [ - ^ anEPMirror value -] From 8e4b5c799da9052cb780d8deb4d2eeaa8d5d0ad9 Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Mon, 12 Sep 2022 13:37:14 +0200 Subject: [PATCH 3/3] removing Ghost and the overlays from the baseline --- .../BaselineOfDebuggableASTInterpreter.class.st | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st index 126d9e6..deeab82 100644 --- a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st +++ b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st @@ -8,24 +8,17 @@ Class { BaselineOfDebuggableASTInterpreter >> baseline: spec [ - spec for: #common do: [ "Dependencies" - spec - baseline: 'Ghost' - with: [ spec repository: 'gitlab://gitlab.inria.fr:RMOD/Ghost' ]. + spec for: #common do: [ "Packages" spec package: 'DebuggableASTInterpreter'; package: 'DebuggableASTDebugger' with: [ - spec requires: #( 'DebuggableASTInterpreter' ) ]; - package: 'DebuggableASTInterpreterOverlays' - with: [ spec requires: #( 'DebuggableASTDebugger' - 'Ghost' ) ] ]. + spec requires: #( 'DebuggableASTInterpreter' ) ] ]. "Groups" spec group: 'default' with: #( 'Model' ); group: 'Model' with: #( 'DebuggableASTInterpreter' ); - group: 'Debugger' with: #( 'DebuggableASTDebugger' ); - group: 'Overlay' with: #( 'DebuggableASTInterpreterOverlays' ) + group: 'Debugger' with: #( 'DebuggableASTDebugger' ) ]