VM Maker: VMMaker.oscogIdeas-eem.2139.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscogIdeas-eem.2139.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscogIdeas-eem.2139.mcz

==================== Summary ====================

Name: VMMaker.oscogIdeas-eem.2139
Author: eem
Time: 24 February 2017, 3:36:08.882371 pm
UUID: f0fc3b40-4fc6-4228-b593-e712981fbe51
Ancestors: VMMaker.oscog-eem.2138

Tastelessness.  Inline asInteger et al in self sends in Character.  Since Sista will do all this and more commit on a branch just to document the code.  But don't put it in trunk because these is no mechanism to flush the methods containing the inlined methods if they are ever redefined (e.g. using MethodWrappers, et al).

=============== Diff against VMMaker.oscog-eem.2138 ===============

Item was added:
+ ----- Method: CogObjectRepresentation>>maybeInlineSendOf:numArgs:receiverTags: (in category 'bytecode generator support') -----
+ maybeInlineSendOf: selectorIndex numArgs: numArgs receiverTags: rcvrTag
+ "Allow the objectRepresentation to inline certain self-sends to immediates if it can."
+ <inline: true>
+ ^false!

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>genPrimitiveImmediateAsInteger (in category 'primitive generators') -----
  genPrimitiveImmediateAsInteger
+ ":Assume the receiver is never a SmallInteger.  One would use ^self for that."
- ":Assume the receiuver is never a SmallInteger.  One would use ^self for that."
  self genConvertCharacterToSmallIntegerInReg: ReceiverResultReg.
  cogit genPrimReturn.
  ^UnfailingPrimitive!

Item was added:
+ ----- Method: CogObjectRepresentationForSpur>>maybeInlineSendOf:numArgs:receiverTags: (in category 'bytecode generator support') -----
+ maybeInlineSendOf: selectorIndex numArgs: numArgs receiverTags: rcvrTag
+ "Allow the objectRepresentation to inline certain self-sends to immediates if it can.
+ We try and inline self asInteger in Character.  We assume this is not a special selector."
+ <inline: true>
+ | methodOrNil |
+ (rcvrTag = objectMemory characterTag
+ and: [numArgs = 0
+ and: [selectorIndex >= 0
+ and: [cogit ssTop isSameEntryAs: (self addressOf: cogit simSelf)]]]) ifFalse:
+ [^false].
+
+ methodOrNil := coInterpreter
+ lookupSelector: (cogit getLiteral: selectorIndex)
+ inClass: objectMemory classCharacter.
+ (methodOrNil notNil
+ and: [(objectMemory isOopCompiledMethod: methodOrNil)
+ and: [(coInterpreter primitiveIndexOf: methodOrNil) = 171]]) ifFalse:
+ [^false].
+
+ cogit ssTop popToReg: ReceiverResultReg.
+ self genConvertCharacterToSmallIntegerInReg: ReceiverResultReg.
+ cogit ssTop type: SSRegister; register: ReceiverResultReg.
+ ^true!

Item was added:
+ ----- Method: CurrentImageCoInterpreterFacade>>lookupSelector:inClass: (in category 'cog jit support') -----
+ lookupSelector: selectorOop inClass: classOop
+ | class selector |
+ class := self objectForOop: classOop.
+ selector := self objectForOop: selectorOop.
+ ^(class canUnderstand: selector) ifTrue:
+ [self oopForObject: ((class whichClassIncludesSelector: selector)
+ compiledMethodAt: selector)]!

Item was added:
+ ----- Method: CurrentImageCoInterpreterFacade>>receiverTagBitsForMethod: (in category 'accessing') -----
+ receiverTagBitsForMethod: anInteger
+ self subclassResponsibility!

Item was added:
+ ----- Method: CurrentImageCoInterpreterFacadeForSpurObjectRepresentation>>receiverTagBitsForMethod: (in category 'accessing') -----
+ receiverTagBitsForMethod: methodOop
+ ^(self objectForOop: methodOop) methodClass
+ caseOf: {
+ [SmallInteger] -> [objectMemory smallIntegerTag].
+ [Character] -> [objectMemory characterTag].
+ [SmallFloat64] -> [objectMemory smallFloatTag] }
+ otherwise: [0]!

Item was added:
+ ----- Method: CurrentImageCoInterpreterFacadeForSqueakV3ObjectRepresentation>>receiverTagBitsForMethod: (in category 'accessing') -----
+ receiverTagBitsForMethod: methodOop
+ ^(self objectForOop: methodOop) methodClass = SmallInteger
+ ifTrue: [1]
+ ifFalse: [0]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genSend:numArgs: (in category 'bytecode generator support') -----
  genSend: selectorIndex numArgs: numArgs
+ "Generate an unlinked send.  Allow the objectRepresentation to inline if it can."
+ | inlined |
+ inlined := objectRepresentation
+ maybeInlineSendOf: selectorIndex
+ numArgs: numArgs
+ receiverTags: receiverTags.
+ inlined ifTrue:
+ [self annotateInstructionForBytecode.
+ ^0].
  self marshallSendArguments: numArgs.
  ^self genMarshalledSend: selectorIndex numArgs: numArgs sendTable: ordinarySendTrampolines!