-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #873 from tesonep/fix-large-classIndex-should-be-p…
…ositive When patching JITed code after become of a class, the class index can look like a negative number
- Loading branch information
Showing
9 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
smalltalksrc/VMMakerTests/VMClassTagInlineReadTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Class { | ||
#name : 'VMClassTagInlineReadTest', | ||
#superclass : 'VMPrimitiveCallAbstractTest', | ||
#pools : [ | ||
'CogRTLOpcodes' | ||
], | ||
#category : 'VMMakerTests-JitTests', | ||
#package : 'VMMakerTests', | ||
#tag : 'JitTests' | ||
} | ||
|
||
{ #category : 'tests' } | ||
VMClassTagInlineReadTest >> testLinkingWithEntryOffset [ | ||
|
||
| sendingMethod targetMethod callSiteReturn | | ||
sendingMethod := self | ||
jitMethod: (self findMethod: #methodWithSend) | ||
selector: memory nilObject. | ||
|
||
targetMethod := self | ||
jitMethod: (self findMethod: #yourself) | ||
selector: memory trueObject. | ||
|
||
callSiteReturn := sendingMethod address + 16r98. | ||
|
||
cogit | ||
linkSendAt: callSiteReturn | ||
in: sendingMethod | ||
to: targetMethod | ||
offset: cogit entryOffset | ||
receiver: memory falseObject. | ||
|
||
self assert: (cogit backend inlineCacheTagAt: callSiteReturn) equals:(memory classIndexOf: memory falseObject) | ||
] | ||
|
||
{ #category : 'tests' } | ||
VMClassTagInlineReadTest >> testLinkingWithEntryOffsetLargeClassIndex [ | ||
|
||
| sendingMethod targetMethod callSiteReturn | | ||
sendingMethod := self | ||
jitMethod: (self findMethod: #methodWithSend) | ||
selector: memory nilObject. | ||
|
||
targetMethod := self | ||
jitMethod: (self findMethod: #yourself) | ||
selector: memory trueObject. | ||
|
||
callSiteReturn := sendingMethod address + 16r98. | ||
|
||
obj := self newZeroSizedObject. | ||
memory setClassIndexOf: obj to: (1 << memory classIndexFieldWidth - 5). | ||
|
||
cogit | ||
linkSendAt: callSiteReturn | ||
in: sendingMethod | ||
to: targetMethod | ||
offset: cogit entryOffset | ||
receiver: obj. | ||
|
||
|
||
self assert: (cogit backend inlineCacheTagAt: callSiteReturn) equals: (1 << memory classIndexFieldWidth - 5) | ||
] |