VM Maker: VMMaker-dtl.374.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-dtl.374.mcz

commits-2
 
David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-dtl.374.mcz

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

Name: VMMaker-dtl.374
Author: dtl
Time: 23 January 2016, 2:13:16.858 pm
UUID: ec1dc8c8-f83d-45a8-b28b-929bd5296795
Ancestors: VMMaker-dtl.373

VMMaker 4.15.1

As of Kernel-eem.971 in the Squeak trunk update stream, primitiveSignalAtUTCMicroseconds
is a required primitive. Provide an implementation for the context interpreter. Tick resolution
continues to be 1 msec (not microsecond precision).

Refoctoring note: The microsecond primitives are currently implemented separately in
the context interpreter and stack interpreter. Future refactoring could move these to
InterpreterPrimitives, such that the oriiginal millisecond tick resolution would be replaced.

=============== Diff against VMMaker-dtl.373 ===============

Item was changed:
  ----- Method: Interpreter class>>initializePrimitiveTable (in category 'initialization') -----
(excessive size, no diff calculated)

Item was added:
+ ----- Method: Interpreter>>primitiveSignalAtUTCMicroseconds (in category 'system control primitives') -----
+ primitiveSignalAtUTCMicroseconds
+ "Cause the time semaphore, if one has been registered, to be
+ signalled when the microsecond clock is greater than or equal to
+ the given tick value. A tick value of zero turns off timer interrupts."
+
+ "Provided for compatibility with StackInterpreter microsecond implementation.
+ This is a required primitive in some newer images, and is implemented here
+ with millisecond precision only."
+
+ | tick sema usecsObj now usecs |
+ <var: #usecs type: #usqLong>
+ <var: #now type: #usqLong>
+ usecsObj := self popStack.
+ sema := self popStack.
+ usecs := self positive64BitValueOf: usecsObj.
+ now := self ioUTCMicroseconds.
+ tick := lastTick + (self cCoerce: usecs - now + 500 / 1000 to: #sqInt). "add 500 for rounding"
+ self successful
+ ifTrue: [(objectMemory fetchClassOf: sema) = (objectMemory splObj: ClassSemaphore)
+ ifTrue: [objectMemory
+ storePointer: TheTimerSemaphore
+ ofObject: objectMemory getSpecialObjectsOop
+ withValue: sema.
+ nextWakeupTick := tick]
+ ifFalse: [objectMemory
+ storePointer: TheTimerSemaphore
+ ofObject: objectMemory getSpecialObjectsOop
+ withValue: objectMemory getNilObj.
+ nextWakeupTick := 0]]
+ ifFalse: [self unPop: 2]!

Item was changed:
  ----- Method: InterpreterPrimitives>>ioUTCMicroseconds (in category 'FIXME') -----
  ioUTCMicroseconds
  "Answer the UTC microseconds since the Smalltalk epoch. The value is
  derived from the Posix epoch (see primitiveUTCMicrosecondClock) with a
  constant offset corresponding to elapsed microseconds between the two
  epochs according to RFC 868."
 
  "Added to Cross/vm/sqVirtualMachine but incompatible with existing timer
  support in Cross. Implemented here to provide the function not present in
  the support code. See also primitiveUTCMicrosecondClock."
 
+ | clock offset epochDelta |
- | clock offset epochDelta uSecs |
  <export: true>
  <returnTypeC: 'usqLong'>
  <var: #clock type: 'sqLong'>
  <var: #offset type: 'int'>
  <var: #epochDelta declareC: 'static usqLong epochDelta= 2177452800000000ULL'>
 
  self flag: #FIXME. "remove this method when platform sources are reconciled"
 
  (self cCode: 'ioUtcWithOffset(&clock, &offset)' inSmalltalk: [-1]) = -1
  ifTrue: [^ self primitiveFail].
+ ^clock + epochDelta.
- clock := clock + epochDelta.
- uSecs := self positive64BitIntegerFor: clock.
- ^uSecs.
  !

Item was added:
+ ----- Method: ObjectMemory>>splObj:put: (in category 'interpreter access') -----
+ splObj: index put: anObject
+ "Set one of the objects in the SpecialObjectsArray"
+ self storePointer: index ofObject: specialObjectsOop withValue: anObject!

Item was changed:
  ----- Method: StackInterpreter class>>additionalHeadersDo: (in category 'translation') -----
  additionalHeadersDo: aBinaryBlock
  "Evaluate aBinaryBlock with the names and contents of
  any additional header files that need to be generated."
  self objectMemoryClass additionalHeadersDo: aBinaryBlock.
+ "aBinaryBlock
- aBinaryBlock
  value: 'vmCallback.h'
+ value: self vmCallbackHeader"!
- value: self vmCallbackHeader!

Item was changed:
  ----- Method: StackInterpreter class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator
  self class == thisContext methodClass ifFalse: [^self]. "Don't duplicate decls in subclasses"
  aCCodeGenerator
  addHeaderFile:'<stddef.h> /* for e.g. alloca */';
+ addHeaderFile:'<setjmp.h>'.
- addHeaderFile:'<setjmp.h>';
- addHeaderFile:'"vmCallback.h"';
- addHeaderFile:'"sqMemoryFence.h"';
- addHeaderFile:'"dispdbg.h"'.
  self declareInterpreterVersionIn: aCCodeGenerator
  defaultName: 'Stack'.
  aCCodeGenerator
  var: #interpreterProxy  type: #'struct VirtualMachine*'.
  aCCodeGenerator
  declareVar: #sendTrace type: 'volatile int';
  declareVar: #byteCount type: 'unsigned long'.
  "These need to be pointers or unsigned."
  self declareC: #(instructionPointer method newMethod)
  as: #usqInt
  in: aCCodeGenerator.
  "These are all pointers; char * because Slang has no support for C pointer arithmetic."
  self declareC: #(localIP localSP localFP stackPointer framePointer stackLimit stackMemory)
  as: #'char *'
  in: aCCodeGenerator.
  self declareC: #(stackPage overflowedPage)
  as: #'StackPage *'
  in: aCCodeGenerator.
  aCCodeGenerator removeVariable: 'stackPages'.  "this is an implicit receiver in the translated code."
  aCCodeGenerator
  var: #methodCache
  declareC: 'long methodCache[MethodCacheSize + 1 /* ', (MethodCacheSize + 1) printString, ' */]'.
  aCCodeGenerator
  var: #atCache
  declareC: 'sqInt atCache[AtCacheTotalSize + 1 /* ', (AtCacheTotalSize + 1) printString, ' */]'.
  aCCodeGenerator
  var: #primitiveTable
  declareC: 'void (*primitiveTable[MaxPrimitiveIndex + 2 /* ', (MaxPrimitiveIndex +2) printString, ' */])(void) = ', self primitiveTableString.
  self primitiveTable do:
  [:symbolOrNot|
  (symbolOrNot isSymbol
  and: [symbolOrNot ~~ #primitiveFail]) ifTrue:
  [(aCCodeGenerator methodNamed: symbolOrNot) ifNotNil:
  [:tMethod| tMethod returnType: #void]]].
  aCCodeGenerator
  var: #primitiveFunctionPointer
  declareC: 'void (*primitiveFunctionPointer)()'.
  aCCodeGenerator
  var: #externalPrimitiveTable
  declareC: 'void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* ', (MaxExternalPrimitiveTableSize + 1) printString, ' */])(void)'.
  aCCodeGenerator var: #showSurfaceFn type: #'void *'.
  aCCodeGenerator
  var: #jmpBuf
  declareC: 'jmp_buf jmpBuf[MaxJumpBuf + 1 /* ', (MaxJumpBuf + 1) printString, ' */]'.
  aCCodeGenerator
  var: #suspendedCallbacks
  declareC: 'usqInt suspendedCallbacks[MaxJumpBuf + 1 /* ', (MaxJumpBuf + 1) printString, ' */]'.
  aCCodeGenerator
  var: #suspendedMethods
  declareC: 'usqInt suspendedMethods[MaxJumpBuf + 1 /* ', (MaxJumpBuf + 1) printString, ' */]'.
  aCCodeGenerator
  var: #interruptCheckChain
  declareC: 'void (*interruptCheckChain)(void) = 0'.
  aCCodeGenerator
  var: #breakSelector type: #'char *';
  var: #breakSelectorLength
  declareC: 'sqInt breakSelectorLength = -1'.
 
  self declareC: #(nextPollUsecs nextWakeupUsecs longRunningPrimitiveGCUsecs
  longRunningPrimitiveStartUsecs longRunningPrimitiveStopUsecs)
  as: #usqLong
  in: aCCodeGenerator.
  aCCodeGenerator var: #nextProfileTick type: #sqLong!

Item was changed:
  ----- Method: VMMaker class>>versionString (in category 'version testing') -----
  versionString
 
  "VMMaker versionString"
 
+ ^'4.15.1'!
- ^'4.14.3'!