From 2182c1eaa68fe5947fc2e5f8edb75cdef31a1fc5 Mon Sep 17 00:00:00 2001 From: Marcus Denker Date: Thu, 3 Dec 2020 15:36:58 +0100 Subject: [PATCH 1/2] Do not add DoIts to the cache for now. fixes #7955 --- src/OpalCompiler-Core/OpalCompiler.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OpalCompiler-Core/OpalCompiler.class.st b/src/OpalCompiler-Core/OpalCompiler.class.st index 7011fd69925..2fd5580a690 100644 --- a/src/OpalCompiler-Core/OpalCompiler.class.st +++ b/src/OpalCompiler-Core/OpalCompiler.class.st @@ -361,7 +361,6 @@ OpalCompiler >> compileDoit [ ast := RBParser parseMethod: ast formattedCode. ast compilationContext: self compilationContext. self doSemanticAnalysis. - ASTCache default at: cm put: ast. ^cm ] From 2e36488bdf16159cf39a75d1c67d100201b367e4 Mon Sep 17 00:00:00 2001 From: Marcus Denker Date: Thu, 3 Dec 2020 16:59:48 +0100 Subject: [PATCH 2/2] intead of caching the DoiT AST, store it as a method property. The AST cache checks this propety first and returns it. --- src/AST-Core/ASTCache.class.st | 9 ++++++--- src/OpalCompiler-Core/OpalCompiler.class.st | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/AST-Core/ASTCache.class.st b/src/AST-Core/ASTCache.class.st index 09efb3773bb..9f270b6742c 100644 --- a/src/AST-Core/ASTCache.class.st +++ b/src/AST-Core/ASTCache.class.st @@ -75,9 +75,12 @@ ASTCache class >> shutDown [ { #category : #accessing } ASTCache >> at: aCompiledMethod [ - ^ self - at: aCompiledMethod - ifAbsentPut: [ self class cacheMissStrategy getASTFor: aCompiledMethod ] + "for doit methods, the ast is stored in the method propery" + ^ aCompiledMethod propertyAt: #ast ifAbsent: [ + self + at: aCompiledMethod + ifAbsentPut: [ + self class cacheMissStrategy getASTFor: aCompiledMethod ] ] ] { #category : #initialization } diff --git a/src/OpalCompiler-Core/OpalCompiler.class.st b/src/OpalCompiler-Core/OpalCompiler.class.st index 2fd5580a690..dd5efb338e2 100644 --- a/src/OpalCompiler-Core/OpalCompiler.class.st +++ b/src/OpalCompiler-Core/OpalCompiler.class.st @@ -361,6 +361,8 @@ OpalCompiler >> compileDoit [ ast := RBParser parseMethod: ast formattedCode. ast compilationContext: self compilationContext. self doSemanticAnalysis. + "we store the ast in the doit method so that the debugger can read variables from the requestor" + cm propertyAt: #ast put: ast. ^cm ]