VM Maker: VMMaker.oscog-nice.1852.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.oscog-nice.1852.mcz

commits-2
 
Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-nice.1852.mcz

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

Name: VMMaker.oscog-nice.1852
Author: nice
Time: 29 April 2016, 9:10:25.503 pm
UUID: c50f4c61-776f-4081-af84-ea320b056c30
Ancestors: VMMaker.oscog-eem.1851

Correct slip in primitiveMethodXray, the flags were not set in each caseOf: branch (thanks to -Wunused-value).

Remove assert in classTagForClass: because ensureBehaviorHash: already does it.

Correct typeCompatibility test.

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

Item was changed:
  ----- Method: CCodeGenerator>>node:typeCompatibleWith:inliningInto:in: (in category 'inlining') -----
  node: exprNode typeCompatibleWith: argName inliningInto: targetMethod in: aTMethod
  "Answer either exprNode or, if required, a cast of exprNode to the type of argName.
  The cast is required if
  - argName is typed and exprNode is untyped
  - argName is untyped and exprNode is an arithmetic type of size > #sqInt
  - both argName and exprNode are typed but they are incompatible"
  | formalType actualType |
  formalType := targetMethod typeFor: argName in: self.
  actualType := self typeFor: exprNode in: aTMethod.
  ^((exprNode isSend or: [exprNode isVariable])
    and: [(formalType notNil and: [actualType isNil])
  or: [(formalType isNil and: [actualType notNil and: [(self isIntegralCType: actualType) and: [(self sizeOfIntegralCType: actualType) > (self sizeOfIntegralCType: #sqInt)]]])
  or: [(self variableOfType: formalType acceptsValue: exprNode ofType: actualType) not]]])
  ifTrue: [self nodeToCast: exprNode to: (formalType ifNil: [#sqInt])]
  ifFalse:
  [((exprNode isSend or: [exprNode isVariable])
   and: [(self
+ variableOfType: (targetMethod typeFor: argName in: self)
- variableOfType: (self typeFor: exprNode in: aTMethod)
  acceptsValue: exprNode
+ ofType: (self typeFor: exprNode in: aTMethod)) not]) ifTrue:
- ofType: (targetMethod typeFor: argName in: self)) not]) ifTrue:
  [logger
  nextPutAll:
  'type mismatch for formal ', argName, ' and actual "', exprNode asString,
  '" when inlining ', targetMethod selector, ' in ', aTMethod selector, '. Use a cast.';
  cr; flush].
  exprNode]!

Item was changed:
  ----- Method: CoInterpreterPrimitives>>primitiveMethodXray (in category 'indexing primitives') -----
  primitiveMethodXray
  "Lift the veil from a method and answer an integer describing the interior state
  of its machine code.
  Used for e.g. VM tests so they can verify they're testing what they think they're testing.
  0 implies a vanilla method.
  Bit 0 = method might be compiled to machine code
  Bit 1 = method is currently compiled to machine code
  Bit 2 = is compiled frameless.
  Bit 3 = method refers to young object.
  Bit 4 = method too big to be jitted (more than 64k of code, or needs more than 1.5Mb of stack space to compile)
  Bit 5 = method contains unknown/unjittable bytecode
+ Bit 6 = method should not be jitted because it contains a primitive not to be called from machine code (unused)"
- Bit 7 = method should not be jitted because it contains a primitive not to be called from machine code (unused)"
  | alreadyCogged flags cogMethod |
  <var: #cogMethod type: #'CogMethod *'>
  (self methodWithHeaderShouldBeCogged: (objectMemory methodHeaderOf: self stackTop))
  ifTrue:
  [alreadyCogged := self maybeMethodHasCogMethod: self stackTop.
  flags := 1.
  alreadyCogged ifFalse:
  [cogMethod := cogit cog: self stackTop selector: objectMemory nilObject.
  (cogMethod = nil
   and: [cogCompiledCodeCompactionCalledFor]) ifTrue:
  [self commenceCogCompiledCodeCompaction.
  cogMethod := cogit cog: self stackTop selector: objectMemory nilObject].
  cogMethod asInteger
  caseOf: {
  [MethodTooBig] -> [flags := 1 + 16].
+ [EncounteredUnknownBytecode] -> [flags := 1 + 32].
+ [ShouldNotJIT] -> [flags := 1 + 64] }
- [EncounteredUnknownBytecode] -> [1 + 32].
- [ShouldNotJIT] -> [1 + 64] }
  otherwise: [self deny: (cogMethod asInteger between: MaxNegativeErrorCode and: NotFullyInitialized)]].
  (flags = 1
   and: [self maybeMethodHasCogMethod: self stackTop]) ifTrue:
  [cogMethod := self cogMethodOf: self stackTop.
  flags := cogMethod stackCheckOffset = 0 ifTrue: [7] ifFalse: [3].
  cogMethod cmRefersToYoung ifTrue:
  [flags := flags + 8].
  alreadyCogged ifFalse:
  [cogit freeMethod: cogMethod]]]
  ifFalse: [flags := 0].
  self pop: 1 thenPush: (objectMemory integerObjectOf: flags)!

Item was changed:
  ----- Method: SpurMemoryManager>>classTagForClass: (in category 'interpreter access') -----
  classTagForClass: classObj
  "Answer the classObj's identityHash to use as a tag in the first-level method lookup cache."
  <api>
- self assert: (coInterpreter addressCouldBeClassObj: classObj).
  ^self ensureBehaviorHash: classObj!