From a11efd95a6ef3f391dbcb72b437c492ab1aae939 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Tue, 19 Nov 2024 16:48:51 +0100 Subject: [PATCH 1/2] Tag some ExternalAddress method as to ignore by testNoEquivalentSuperclassMethods ExternalAddress reimplement multiple methods from it superclass to do the same and have some speed ups. Here I'm adding a pragma so that we declare them as false positive in testNoEquivalentSuperclassMethods with the goal of reducing little by little the number of violations of this test --- src/ReleaseTests/ReleaseTest.class.st | 2 +- src/UnifiedFFI/ExternalAddress.extension.st | 60 +++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/ReleaseTests/ReleaseTest.class.st b/src/ReleaseTests/ReleaseTest.class.st index 8793f4286b5..ce2d8c865c4 100644 --- a/src/ReleaseTests/ReleaseTest.class.st +++ b/src/ReleaseTests/ReleaseTest.class.st @@ -322,7 +322,7 @@ ReleaseTest >> testNoEquivalentSuperclassMethods [ ifNotNil: [ :overridenMethod | method equivalentTo: overridenMethod ] ifNil: [ false ] ]. - self assert: methods size <= 326 + self assert: methods size <= 300 ] { #category : 'tests - variables' } diff --git a/src/UnifiedFFI/ExternalAddress.extension.st b/src/UnifiedFFI/ExternalAddress.extension.st index bd7c3f1d2ca..2ab0541a0c9 100644 --- a/src/UnifiedFFI/ExternalAddress.extension.st +++ b/src/UnifiedFFI/ExternalAddress.extension.st @@ -47,12 +47,16 @@ ExternalAddress >> boolean8AtOffset: zeroBasedOffset put: value [ { #category : '*UnifiedFFI' } ExternalAddress >> booleanAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self boolean8AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> booleanAt: byteIndex put: value [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self boolean8AtOffset: byteIndex - 1 put: value ] @@ -109,12 +113,16 @@ ExternalAddress >> copyFromOffset: startZeroBasedOffset to: endZeroBasedOffset [ { #category : '*UnifiedFFI' } ExternalAddress >> doubleAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self float64AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> doubleAt: byteIndex put: value [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self float64AtOffset: byteIndex - 1 put: value ] @@ -152,12 +160,16 @@ ExternalAddress >> float64AtOffset: zeroBasedOffset put: value [ { #category : '*UnifiedFFI' } ExternalAddress >> floatAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self float32AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> floatAt: byteIndex put: value [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self float32AtOffset: byteIndex - 1 put: value ] @@ -333,12 +345,16 @@ ExternalAddress >> pointer [ { #category : '*UnifiedFFI' } ExternalAddress >> pointerAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self pointerAtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> pointerAt: byteIndex put: value [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self pointerAtOffset: byteIndex - 1 put: value ] @@ -419,41 +435,65 @@ ExternalAddress >> replaceFrom: start to: stop with: replacement startingAt: rep { #category : '*UnifiedFFI' } ExternalAddress >> signedCharAt: byteOffset [ + "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self char8AtOffset: byteOffset - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> signedCharAt: byteIndex put: aCharacter [ + "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self char8AtOffset: byteIndex - 1 put: aCharacter ] { #category : '*UnifiedFFI' } ExternalAddress >> signedLongAt: byteIndex [ + "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self int32AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> signedLongAt: byteIndex put: value [ + "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self int32AtOffset: byteIndex - 1 put: value ] { #category : '*UnifiedFFI' } ExternalAddress >> signedLongLongAt: byteIndex [ + "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self int64AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> signedLongLongAt: byteIndex put: value [ + "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self int64AtOffset: byteIndex - 1 put: value ] { #category : '*UnifiedFFI' } ExternalAddress >> signedShortAt: byteIndex [ + "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self int16AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> signedShortAt: byteIndex put: value [ + "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self int16AtOffset: byteIndex - 1 put: value ] @@ -527,60 +567,80 @@ ExternalAddress >> unpackHandleFromArity: arity [ { #category : '*UnifiedFFI' } ExternalAddress >> unsignedByteAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self uint8AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedByteAt: byteIndex put: value [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self uint8AtOffset: byteIndex - 1 put: value ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedCharAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self char8AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedCharAt: byteIndex put: aCharacter [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self char8AtOffset: byteIndex - 1 put: aCharacter ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedLongAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self uint32AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedLongAt: byteIndex put: value [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self uint32AtOffset: byteIndex - 1 put: value ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedLongLongAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self uint64AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedLongLongAt: byteIndex put: value [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self uint64AtOffset: byteIndex - 1 put: value ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedShortAt: byteIndex [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self uint16AtOffset: byteIndex - 1 ] { #category : '*UnifiedFFI' } ExternalAddress >> unsignedShortAt: byteIndex put: value [ "This method is duplicated in this subclass with the purpose of ensuring a monomorphic inline cache in the following message send." + + ^ self uint16AtOffset: byteIndex - 1 put: value ] From c13e0268f383bbdb97809c6166ab7a624d4cbffa Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Thu, 21 Nov 2024 14:10:01 +0100 Subject: [PATCH 2/2] Update testNoEquivalentSuperclassMethods --- src/ReleaseTests/ReleaseTest.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ReleaseTests/ReleaseTest.class.st b/src/ReleaseTests/ReleaseTest.class.st index ce2d8c865c4..ad97d38b784 100644 --- a/src/ReleaseTests/ReleaseTest.class.st +++ b/src/ReleaseTests/ReleaseTest.class.st @@ -322,7 +322,7 @@ ReleaseTest >> testNoEquivalentSuperclassMethods [ ifNotNil: [ :overridenMethod | method equivalentTo: overridenMethod ] ifNil: [ false ] ]. - self assert: methods size <= 300 + self assert: methods size <= 305 ] { #category : 'tests - variables' }