Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes + adding possibility to switch from bytecode interpreter to DAST interpreter and vice-versa #29

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6b4de4b
updating ASTInterpreter and visitors according to nez API for Tempora…
adri09070 Aug 18, 2022
474dbd3
updating ASTInterpreter and ASTPostOrderTreeVisitor according to new …
adri09070 Aug 30, 2022
cae98fc
Merge pull request #1 from adri09070/Pharo11
adri09070 Sep 6, 2022
91d5689
removing deprecated spec-debugger dependency + adding espell dependen…
adri09070 Sep 6, 2022
a6aed4d
Merge pull request #2 from adri09070/fixing-baseline-dependencies
adri09070 Sep 9, 2022
0d010c7
Merge 34491bb2ac9f3c256eb734f8856e61c0ca1a9297
adri09070 Sep 23, 2022
21444f5
synch with RMODINRIA/DebuggableASTInterpreter
adri09070 Sep 23, 2022
4c062f5
Merge 9b23f619a341745a94a7a52fbf39633d7190862e
adri09070 Sep 26, 2022
d2987ba
implementing asContext for rootContext
adri09070 Nov 4, 2022
1f84fee
adding test so that asContext and its senders keep same receiver, arg…
adri09070 Nov 7, 2022
9f415b3
applying node -> pc equivalence in asContext
adri09070 Nov 7, 2022
058026f
adding test to check that asContext creates a context that gives the …
adri09070 Nov 7, 2022
aa8d199
making sure that DASTBlockContext asContext keeps same receiver; send…
adri09070 Nov 7, 2022
e04a8c5
testing DASTBlockContext>>#asContext keeps same stack and PC equivalence
adri09070 Nov 7, 2022
e03328d
testing that DASTBlockContext>>#asContext has same result as the bloc…
adri09070 Nov 7, 2022
4d8af2e
ajout d'un rootContext qui termine le processus lors de la traduction…
adri09070 Nov 15, 2022
389f616
experiment Context -> DASTContext
adri09070 Nov 25, 2022
6aea1e8
bytecode to DAST interpreter switch + small DAST debugger prototype
adri09070 Jan 30, 2023
2651f8c
bytecode to DAST interpreter switch + small DAST debugger prototype
adri09070 Jan 30, 2023
1f8d45e
Adding a no method class to perform a semantic analysis only when the…
adri09070 Jan 30, 2023
2014aea
Merge 2651f8c98cfce738490995fd7776a907343b5ac4
adri09070 Jan 30, 2023
ee28860
adding buttons to DAST debugger + recovering lost changes
adri09070 Jan 30, 2023
53410ce
test interpreter switch binding conservations
adri09070 Feb 3, 2023
79f21bf
test interpreter switch keeps receiver unchanged + next nodesis the o…
adri09070 Feb 3, 2023
3e5c741
adding failing tests
adri09070 Feb 3, 2023
ebc28cd
adding tests for interpreter switch to ensure that:
adri09070 Feb 6, 2023
9b812b6
fixing some tests
adri09070 Feb 6, 2023
47b1bb7
Fixing root test
adri09070 Feb 10, 2023
24bff41
fiixng debugger opening
adri09070 Feb 10, 2023
19c8409
adding a test: performing steps after switching interpreter
adri09070 Feb 10, 2023
255d9b4
- adding DAST interpreter tests about inlined code
adri09070 Feb 13, 2023
0073289
tests DAST -> Bytecode (receiver, bindings) + upgrdng DAN
adri09070 Feb 16, 2023
8713510
block context receiver fix, DAST->bc
adri09070 Feb 16, 2023
e1402e8
fixing number of steps in DAST->bc tests + adding other DAST->bc test…
adri09070 Feb 16, 2023
2cdc45c
fixing bc->DAST receiver recursively test
adri09070 Feb 17, 2023
03fd2e8
better temp gestion in DASTBlockContext + better creation of FullBloc…
adri09070 Feb 20, 2023
818fc05
mapping DASTBlock to their pharo outer context. All tests are green
adri09070 Feb 21, 2023
0ca9f17
handling DASTBreakpoints
adri09070 Feb 21, 2023
1e652ce
adding DASTBreakpoint
adri09070 Feb 21, 2023
2971bc6
code example DASTBreakpoint
adri09070 Feb 21, 2023
749f039
Adding possibility to add DAST breakpoints in Calypso
adri09070 Feb 21, 2023
8c9af49
dast->bc switch with vector of temps
adri09070 Feb 21, 2023
4a023d7
bc -> DAST temp vector switch
adri09070 Feb 22, 2023
9e065ff
adding a button to switch to another debugger from the DAST debugger
adri09070 Feb 22, 2023
272c827
Merge pull request #3 from adri09070/switch-with-vector-temps
adri09070 Feb 23, 2023
c753321
Merge pull request #4 from adri09070/24-We-need-an-equivalence-betwee…
adri09070 Feb 23, 2023
cb07e88
adding SwitchToDAST
adri09070 Feb 23, 2023
1fc3d31
removing super call
adri09070 Feb 23, 2023
90cfc37
fixing StSwitchToDASTCommand + making DASTException an OupsNullExcept…
adri09070 Feb 23, 2023
632ea6d
test bc->DAST optimized ifs
adri09070 Mar 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions DebuggableASTDebugger/BlockClosure.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Extension { #name : #BlockClosure }

{ #category : #'*DebuggableASTDebugger' }
BlockClosure >> bcToDASTValue [

^ DASTBlock new
initializeWith: self compiledBlock ast;
pharoOuterContext: self outerContext;
yourself
]
14 changes: 14 additions & 0 deletions DebuggableASTDebugger/Context.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Extension { #name : #Context }

{ #category : #'*DebuggableASTDebugger' }
Context >> dastValueFor: anObject interpretedBy: aDASTInterpreter withClosureToBlockDictionary: closureToDASTBlock [

| value |
(closureToDASTBlock includesKey: anObject) ifTrue: [
^ closureToDASTBlock at: anObject ].
value := anObject bcToDASTValue.
value isBlock ifTrue: [
value outerContext: self. "aDASTInterpreter currentContext"
closureToDASTBlock at: anObject put: value ].
^ value
]
7 changes: 7 additions & 0 deletions DebuggableASTDebugger/DASTBlock.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #DASTBlock }

{ #category : #'*DebuggableASTDebugger' }
DASTBlock >> dastToBcValue [

^ self closure
]
15 changes: 15 additions & 0 deletions DebuggableASTDebugger/DASTBlockContext.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Extension { #name : #DASTBlockContext }

{ #category : #'*DebuggableASTDebugger' }
DASTBlockContext >> tempNamed: aTempVarName [

^ [ super tempNamed: aTempVarName ]
on: KeyNotFound
do: [
[
self sender
ifNotNil: [ self sender tempNamed: aTempVarName ]
ifNil: [ closure outerContext tempNamed: aTempVarName ] ]
on: KeyNotFound
do: [ closure outerContext tempNamed: aTempVarName ] ]
]
195 changes: 195 additions & 0 deletions DebuggableASTDebugger/DASTDebugger.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
Class {
#name : #DASTDebugger,
#superclass : #SpPresenter,
#traits : 'TDebugger',
#classTraits : 'TDebugger classTrait',
#instVars : [
'stack',
'code',
'interpreter',
'toolBar',
'simulatorSession',
'switchButton'
],
#category : #DebuggableASTDebugger
}

{ #category : #'instance creation' }
DASTDebugger class >> debugSession: aDebugSession [

| dast |
dast := self basicNew.
dast simulatorSession: aDebugSession.
aDebugSession interruptedContext receiver class == DASTBreakpoint
ifTrue: [
aDebugSession stepInto.
aDebugSession stepInto ].
dast interpreter:
(DASTInterpreter startFromContext: aDebugSession interruptedContext).
dast initialize.
dast open
]

{ #category : #accessing }
DASTDebugger class >> defaultDebuggerRank [

^ 10
]

{ #category : #debugging }
DASTDebugger class >> handlesDebugSession: aDebugSession [

^ aDebugSession exception class = DASTException or: [
aDebugSession interruptedContext receiver class = DASTBreakpoint ]
]

{ #category : #initialization }
DASTDebugger >> buildToolbar [

^ self newToolbar
addItem: (SpToolbarButtonPresenter new
label: 'Proceed';
icon: (self iconNamed: #glamorousSpawn);
action: [ self proceed ];
yourself);
addItem: (SpToolbarButtonPresenter new
label: 'Step';
icon: (self iconNamed: #down);
action: [ self stepInterpreter ];
yourself);
addItem: (SpToolbarButtonPresenter new
label: 'Step over';
icon: (self iconNamed: #forward);
action: [ self stepOver ];
yourself);
addItem: (SpToolbarButtonPresenter new
label: 'Step through';
icon: (self iconNamed: #glamorousThrough);
action: [ self stepThrough ];
yourself);
addItem: (SpToolbarButtonPresenter new
label: 'Restart';
icon: (self iconNamed: #glamorousRestart);
action: [ self restart ];
yourself);
yourself
]

{ #category : #accessing }
DASTDebugger >> clear [
simulatorSession terminate
]

{ #category : #layout }
DASTDebugger >> defaultLayout [

^ SpBoxLayout newVertical
add: (SpBoxLayout newTopToBottom
add: switchButton
expand: false
fill: false
padding: 5;
add: stack;
yourself);
add: toolBar expand: false;
add: code;
yourself
]

{ #category : #initialization }
DASTDebugger >> initializePresenters [

code := self newCode.
stack := self newList
transmitDo: [ :ctx | self updateCodeFromContext: ctx ];
yourself.
toolBar := self buildToolbar.
switchButton := self newButton action: [ self switchToOtherDebugger ].
self updateStack
]

{ #category : #accessing }
DASTDebugger >> interpreter: aDASTInterpreter [

interpreter := aDASTInterpreter
]

{ #category : #menu }
DASTDebugger >> proceed [

interpreter evaluate.
self updateStack
]

{ #category : #menu }
DASTDebugger >> restart [

interpreter restart: stack selectedItem.
self updateStack
]

{ #category : #accessing }
DASTDebugger >> simulatorSession: anObject [

simulatorSession := anObject
]

{ #category : #'as yet unclassified' }
DASTDebugger >> stepInterpreter [


interpreter stepInto.
self updateStack
]

{ #category : #'debug - stepping' }
DASTDebugger >> stepOver [

interpreter stepOver.
self updateStack
]

{ #category : #actions }
DASTDebugger >> stepThrough [

interpreter stepThrough.
self updateStack
]

{ #category : #initialization }
DASTDebugger >> switchToOtherDebugger [

| context process |
context := interpreter currentContext asContext.
process := Process
forContext: context
priority: Processor userInterruptPriority.
(OupsDebugRequest newForContext: context)
label: context compiledCode printString;
process: process;
submit.
self clear.
self window close
]

{ #category : #'presenter - code' }
DASTDebugger >> updateCodeFromContext: aDASTContext [

aDASTContext ifNil: [ ^ nil ].
code text: aDASTContext sourceCode.
code beForContext: aDASTContext.
code removeAllTextSegmentDecorations.

code addTextSegmentDecoration: (SpTextPresenterDecorator forHighlight
interval: (aDASTContext currentNode start to: aDASTContext currentNode stop + 1);
yourself).

]

{ #category : #'as yet unclassified' }
DASTDebugger >> updateStack [

stack
items: interpreter contextsStack;
selectFirst
]
13 changes: 13 additions & 0 deletions DebuggableASTDebugger/Object.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Extension { #name : #Object }

{ #category : #'*DebuggableASTDebugger' }
Object >> bcToDASTValue [

^ self
]

{ #category : #'*DebuggableASTDebugger' }
Object >> dastToBcValue [

^ self
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Class {
#name : #ClyAddDASTBreakpointCommand,
#superclass : #ClyAddStaticBreakpointCommand,
#category : #DebuggableASTDebuggerExperiment
}

{ #category : #testing }
ClyAddDASTBreakpointCommand class >> canBeExecutedInContext: aBrowserContext [

^ (super canBeExecutedInContext: aBrowserContext) and: [
aBrowserContext isSelectedItemHasBreakpoint not ]
]

{ #category : #activation }
ClyAddDASTBreakpointCommand class >> contextMenuOrder [
<classAnnotationDependency>
^1
]

{ #category : #testing }
ClyAddDASTBreakpointCommand class >> isAbstract [
^self = ClyAddBreakpointCommand
]

{ #category : #accessing }
ClyAddDASTBreakpointCommand >> defaultMenuItemName [
^'DAST breakpoint'
]

{ #category : #execution }
ClyAddDASTBreakpointCommand >> execute [

| breakpoint |
breakpoint := DASTBreakpoint new node: sourceNode.
breakpoint install
]
12 changes: 12 additions & 0 deletions DebuggableASTDebuggerExperiment/DASTBreakpoint.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"
1/0.
bp :=
DASTBreakpoint new node: (StDebuggerObjectForTests>>#instVar) ast.
bp install.
StDebuggerObjectForTests new instVar
"
Class {
#name : #DASTBreakpoint,
#superclass : #Breakpoint,
#category : #DebuggableASTDebuggerExperiment
}
20 changes: 20 additions & 0 deletions DebuggableASTDebuggerExperiment/StDebugger.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Extension { #name : #StDebugger }

{ #category : #'*DebuggableASTDebuggerExperiment' }
StDebugger class >> buildDASTCommandsGroupWith: stDebuggerInstance forRoot: aRootGroup [

<extensionCommands>
| configGroup dastConfigGroup |
configGroup := aRootGroup
/ StDebuggerConfigurationCommandTreeBuilder groupName.
dastConfigGroup := StDebuggerConfigurationCommandTreeBuilder new
dastConfigurationCommandsGroup.
configGroup register: dastConfigGroup
]

{ #category : #'*DebuggableASTDebuggerExperiment' }
StDebugger >> programmaticallyClose [

programmaticallyClosed := true.
self withWindowDo: #close
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Extension { #name : #StDebuggerConfigurationCommandTreeBuilder }

{ #category : #'*DebuggableASTDebuggerExperiment' }
StDebuggerConfigurationCommandTreeBuilder >> dastConfigurationCommandsClasses [

^ { StSwitchToDASTCommand }
]

{ #category : #'*DebuggableASTDebuggerExperiment' }
StDebuggerConfigurationCommandTreeBuilder >> dastConfigurationCommandsGroup [

| group |
group := (CmCommandGroup named: self dastConfigurationGroupName)
asSpecGroup.
group beDisplayedAsSubMenu.
group description: self dastConfigurationGroupDescription.
self dastConfigurationCommandsClasses do: [ :c |
group register:
(self buildSpecCommand: c forContext: stDebuggerInstance) ].
^ group
]

{ #category : #'*DebuggableASTDebuggerExperiment' }
StDebuggerConfigurationCommandTreeBuilder >> dastConfigurationGroupDescription [

^ 'Configuration commands to perform actions with DAST interpreter'
]

{ #category : #'*DebuggableASTDebuggerExperiment' }
StDebuggerConfigurationCommandTreeBuilder >> dastConfigurationGroupName [

^ 'DAST configuration'
]
29 changes: 29 additions & 0 deletions DebuggableASTDebuggerExperiment/StSwitchToDASTCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Class {
#name : #StSwitchToDASTCommand,
#superclass : #StDebuggerCommand,
#category : #DebuggableASTDebuggerExperiment
}

{ #category : #initialization }
StSwitchToDASTCommand class >> defaultIconName [

^ #halt
]

{ #category : #initialization }
StSwitchToDASTCommand class >> defaultShortcut [

^ $d meta , $s meta
]

{ #category : #executing }
StSwitchToDASTCommand >> execute [

| session |
session := self context session.
self context programmaticallyClose.
(OupsDebugRequest newForContext: context)
label: session interruptedContext compiledCode printString;
exception: (DASTException fromSignallerContext: session interruptedContext);
"DASTDebugger debugSession: session"submit
]
1 change: 1 addition & 0 deletions DebuggableASTDebuggerExperiment/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #DebuggableASTDebuggerExperiment }
Loading