[commit] r2244 - Fix heartbeat clock log (-ve % +ve => -ve bounds violation).

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

[commit] r2244 - Fix heartbeat clock log (-ve % +ve => -ve bounds violation).

commits-3
 
Author: eliot
Date: 2010-07-20 11:20:26 -0700 (Tue, 20 Jul 2010)
New Revision: 2244

Modified:
   branches/Cog/image/VMMaker-Squeak4.1.changes
   branches/Cog/image/VMMaker-Squeak4.1.image
   branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
   branches/Cog/platforms/win32/vm/sqWin32Heartbeat.c
Log:
Fix heartbeat clock log (-ve % +ve => -ve bounds violation).
This will hopefully fix crashes in the heartbeat under linux.


Modified: branches/Cog/image/VMMaker-Squeak4.1.changes
===================================================================
--- branches/Cog/image/VMMaker-Squeak4.1.changes 2010-07-20 04:05:05 UTC (rev 2243)
+++ branches/Cog/image/VMMaker-Squeak4.1.changes 2010-07-20 18:20:26 UTC (rev 2244)
@@ -123956,4 +123956,99 @@
  rep user: user;
  password: pw ]!
 
-----QUIT----{17 July 2010 . 6:22:30 pm} VMMaker-Squeak4.1.image priorSource: 4999487!
\ No newline at end of file
+----QUIT----{17 July 2010 . 6:22:30 pm} VMMaker-Squeak4.1.image priorSource: 4999487!
+
+----STARTUP----{18 July 2010 . 6:31:23 pm} as /Users/eliot/Cog/oscog/Cog.squeakvm.org/image/VMMaker-Squeak4.1.image!
+
+
+'From Squeak4.1 of 17 April 2010 [latest update: #9957] on 18 July 2010 at 6:29:08 pm'!
+!Cogit methodsFor: 'disassembly' stamp: 'eem 7/18/2010 18:10' prior: 35256882!
+disassembleMethod: surrogateOrAddress on: aStream
+ <doNotGenerate>
+ | cogMethod mapEntries codeRanges mcpcToBcpcMap |
+ cogMethod := surrogateOrAddress isInteger
+ ifTrue: [coInterpreter cogMethodSurrogateAt: surrogateOrAddress]
+ ifFalse: [surrogateOrAddress].
+ cogMethod cmType = CMBlock ifTrue:
+ [^self disassembleMethod: (self cogHomeMethod: cogMethod) on: aStream].
+ self printMethodHeader: cogMethod on: aStream.
+
+ (mapEntries := Dictionary new)
+ at: cogMethod asInteger + cmEntryOffset put: 'entry'.
+
+ cogMethod cmType = CMMethod ifTrue:
+ [mapEntries at: cogMethod asInteger + cmNoCheckEntryOffset put: 'noCheckEntry'].
+
+ cogMethod cmType = CMClosedPIC ifTrue:
+ [mapEntries at: cogMethod asInteger + firstCPICCaseOffset put: 'ClosedPICCase0'.
+ 1 to: numPICCases - 1 do:
+ [:i|
+ mapEntries
+ at: cogMethod asInteger + firstCPICCaseOffset + (i * cPICCaseSize)
+ put: 'ClosedPICCase', i printString]].
+
+ self mapFor: cogMethod
+ performUntil: #collectMapEntry:address:into: asSymbol
+ arg: mapEntries.
+
+ "This would all be far more elegant and simple if we used blocks.
+ But there are no blocks in C and the basic enumerators here need
+ to be used in the real VM.  Apologies."
+ mcpcToBcpcMap := self mcpcToBcpcMapFor: cogMethod.
+ (codeRanges := self codeRangesFor: cogMethod) do:
+ [:range|
+ range startpc: (mcpcToBcpcMap at: range first ifAbsent: [nil]).
+ (cogMethod blockEntryOffset ~= 0
+ and: [range first = (cogMethod blockEntryOffset + cogMethod asInteger)])
+ ifTrue:
+ [aStream nextPutAll: 'blockEntry:'; cr.
+ self blockDispatchFor: cogMethod
+ perform: #disassemble:from:to:arg:
+ arg: { aStream. mcpcToBcpcMap }]
+ ifFalse:
+ [range first > (cogMethod address + cmNoCheckEntryOffset) ifTrue:
+ [self printMethodHeader: (self cCoerceSimple: range first - (self sizeof: CogBlockMethod)
+ to: #'CogBlockMethod *')
+ on: aStream].
+ self disassembleFrom: range first to: range last labels: mapEntries on: aStream]].
+ aStream nextPutAll: 'startpc: '; print: codeRanges first startpc; cr.
+ (cogMethod cmType = CMMethod
+ or: [cogMethod cmType = CMOpenPIC]) ifTrue:
+ [[self mapFor: cogMethod
+ performUntil: #printMapEntry:mcpc:args:
+ arg: { aStream. codeRanges. cogMethod }]
+ on: AssertionFailure
+ do: [:ex|
+ ex primitiveChangeClassTo: MyResumableTestError basicNew. ":) :) :)"
+ ex resume: nil]]! !
+!CogVMSimulator methodsFor: 'simulation only' stamp: 'eem 7/18/2010 18:28'!
+transcript: aTranscript
+ transcript := aTranscript! !
+!StackInterpreterSimulator methodsFor: 'simulation only' stamp: 'eem 7/18/2010 18:28'!
+transcript: aTranscript
+ transcript := aTranscript! !
+
+| user pw |
+Utilities setAuthorInitials.
+user := UIManager default request: 'Unix user name'.
+pw := UIManager default requestPassword: 'Monticello password'.
+MCHttpRepository allSubInstancesDo: [ : rep |
+ rep user: user;
+ password: pw ]!
+
+"VMMaker"!
+
+| user pw |
+Utilities setAuthorInitials.
+user := UIManager default request: 'Unix user name'.
+pw := UIManager default requestPassword: 'Monticello password'.
+MCHttpRepository allSubInstancesDo: [ : rep |
+ rep user: user;
+ password: pw ]!
+
+----QUIT----{18 July 2010 . 6:48:18 pm} VMMaker-Squeak4.1.image priorSource: 5000183!
+
+----STARTUP----{19 July 2010 . 2:36:15 pm} as /Users/eliot/Cog/oscog/Cog.squeakvm.org/image/VMMaker-Squeak4.1.image!
+
+
+----QUIT/NOSAVE----{19 July 2010 . 2:41:01 pm} VMMaker-Squeak4.1.image priorSource: 5003704!
\ No newline at end of file

Modified: branches/Cog/image/VMMaker-Squeak4.1.image
===================================================================
(Binary files differ)

Modified: branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c 2010-07-20 04:05:05 UTC (rev 2243)
+++ branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c 2010-07-20 18:20:26 UTC (rev 2244)
@@ -52,9 +52,9 @@
 # define LOGSIZE 1024
 static unsigned long long useclog[LOGSIZE];
 static unsigned long mseclog[LOGSIZE];
-static int logClock = 1;
-static int ulogidx = -1;
-static int mlogidx = -1;
+static int logClock = 0;
+static unsigned int ulogidx = (unsigned int)-1;
+static unsigned int mlogidx = (unsigned int)-1;
 # define logusecs(usecs) do { sqLowLevelMFence(); \
  if (logClock) useclog[++ulogidx % LOGSIZE] = (usecs); \
  } while (0)
@@ -590,7 +590,6 @@
 beatStateMachine(void *careLess)
 {
  int er;
-#if !ONLY_ONE_THREAD_PRIORITY
  if ((er = pthread_setschedparam(pthread_self(),
  stateMachinePolicy,
  &stateMachinePriority))) {
@@ -599,10 +598,9 @@
  * policies are only available to processes with superuser privileges.
  */
  errno = er;
- perror("pthread_setschedparam failed");
+ perror("pthread_setschedparam failed; consider using ITIMER_HEARTBEAT");
  exit(errno);
  }
-#endif /* !ONLY_ONE_THREAD_PRIORITY */
  beatState = active;
  while (beatState != condemned) {
 # define MINSLEEPNS 2000 /* don't bother sleeping for short times */

Modified: branches/Cog/platforms/win32/vm/sqWin32Heartbeat.c
===================================================================
--- branches/Cog/platforms/win32/vm/sqWin32Heartbeat.c 2010-07-20 04:05:05 UTC (rev 2243)
+++ branches/Cog/platforms/win32/vm/sqWin32Heartbeat.c 2010-07-20 18:20:26 UTC (rev 2244)
@@ -140,9 +140,9 @@
 # define LOGSIZE 1024
 static unsigned __int64 useclog[LOGSIZE];
 static unsigned long mseclog[LOGSIZE];
-static int logClock = 1;
-static int ulogidx = -1;
-static int mlogidx = -1;
+static int logClock = 0;
+static unsigned int ulogidx = (unsigned int)-1;
+static unsigned int mlogidx = (unsigned int)-1;
 # define logusecs(usecs) do { sqLowLevelMFence(); \
  if (logClock) useclog[++ulogidx % LOGSIZE] = (usecs); \
  } while (0)