Skip to content

Commit

Permalink
Merge branch 'stable-3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzini committed May 19, 2012
2 parents 0e5396a + 99cca15 commit 8cc8bfc
Show file tree
Hide file tree
Showing 22 changed files with 288 additions and 163 deletions.
41 changes: 41 additions & 0 deletions ChangeLog
@@ -1,3 +1,44 @@
2012-05-19 Paolo Bonzini <bonzini@gnu.org>

* kernel/Delay.st: Switch to nanosecond-precision.
* kernel/ProcSched.st: Rename #signal:atMillisecondClockValue:
to #signal:atNanosecondClockValue:.

2012-05-19 Paolo Bonzini <bonzini@gnu.org>

* libgst/sysdep.h: Rename _gst_init_sysdep_win32 to
_gst_init_sysdep_timer.
* libgst/sysdep/common/files.c: Likewise.
* libgst/sysdep/cygwin/timer.c: Likewise.
* libgst/sysdep/win32/timer.c: Likewise.
* libgst/sysdep/posix/timer.c: Support POSIX real-time timers.

2012-05-19 Paolo Bonzini <bonzini@gnu.org>

* kernel/Delay.st: Use #signal:atMillisecondClockValue:.
* kernel/ProcSched.st: Define #signal:atMillisecondClockValue:.

2012-05-19 Paolo Bonzini <bonzini@gnu.org>

* kernel/Random.st: Do not use #primMillisecondClock.
* kernel/Time.st: Base time on nanoseconds.

2012-05-13 Stefano Lattarini <stefano.lattarini@gmail.com> (tiny change)

build: don't use obsolescent AM_PROG_CC_STDC and AM_CONFIG_HEADER

The Automake-provided macros 'AM_PROG_CC_STDC' and 'AM_CONFIG_HEADER'
have been superseded respectively by the Autoconf-provided ones
'AC_PROG_CC' (since October 2002) and 'AC_CONFIG_HEADERS' (since July
2002). Moreover, those obsolescent macros will be removed in the next
major Automake version (1.13). Stop using them.

* configure.ac (AM_CONFIG_HEADER): Don't use this, ...
(AC_CONFIG_HEADERS): ... use this instead. While we are at it,
properly quote the argument.
* snprintfv/configure.ac (AM_PROG_CC_STDC): Drop this, the invocation
to AC_PROG_CC is enough.

2012-03-29 Paolo Bonzini <bonzini@gnu.org>

* tests/compiler.st: Add testcase.
Expand Down
6 changes: 3 additions & 3 deletions build-aux/libc-so-name.m4
Expand Up @@ -33,18 +33,18 @@ if test "$gst_cv_libc_dlopen_works" = no; then
fi
AC_CACHE_CHECK([how to dlopen the C library], gst_cv_libc_so_name, [
gst_lib_path=
if test $GCC = yes; then
if $CC -print-multiarch >/dev/null 2>&1; then
gst_lib_path=`$CC -print-multiarch $CFLAGS $CPPFLAGS`
else
fi
if test -z "$gst_lib_path"; then
gst_lib_path=`$CC --print-multi-os-directory $CFLAGS $CPPFLAGS`
fi
case $gst_lib_path in
.) gst_lib_path= ;;
*) gst_lib_path=$gst_lib_path/ ;;
esac
else
gst_lib_path=
fi
case $gst_lib_path in
/*) gst_libc_search_path="${gst_lib_path}libc.so*
Expand Down
7 changes: 6 additions & 1 deletion configure.ac
Expand Up @@ -19,7 +19,7 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux])
AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_TESTDIR(tests)
AM_CONFIG_HEADER(config.h)
AC_CONFIG_HEADERS([config.h])
GST_PROG_GAWK
AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
Expand Down Expand Up @@ -379,6 +379,11 @@ if test "$ac_cv_search_clock_gettime" != no; then
[Define if the system provides clock_gettime.])
fi

AC_SEARCH_LIBS([timer_create], [rt])
if test "$ac_cv_search_timer_create" != no; then
AC_DEFINE(HAVE_TIMER_CREATE, 1,
[Define if the system provides timer_create.])
fi

GST_FUNC_LRINT
GST_FUNC_STRTOUL
Expand Down
40 changes: 27 additions & 13 deletions kernel/Delay.st
Expand Up @@ -49,25 +49,39 @@ created.'>
IdleProcess := nil.
TimeoutSem := nil.

Delay class >> forNanoseconds: nanosecondCount [
"Answer a Delay waiting for nanosecondCount nanoseconds"

<category: 'instance creation'>
^self new initForNanoseconds: nanosecondCount
]

Delay class >> forMilliseconds: millisecondCount [
"Answer a Delay waiting for millisecondCount milliseconds"

<category: 'instance creation'>
^self new initForMilliseconds: millisecondCount
^self forNanoseconds: millisecondCount * 1000000
]

Delay class >> forSeconds: secondCount [
"Answer a Delay waiting for secondCount seconds"

<category: 'instance creation'>
^self forMilliseconds: secondCount * 1000
^self forNanoseconds: secondCount * 1000000000
]

Delay class >> untilNanoseconds: nanosecondCount [
"Answer a Delay waiting until nanosecondCount nanoseconds after startup"

<category: 'instance creation'>
^self new initUntilNanoseconds: nanosecondCount
]

Delay class >> untilMilliseconds: millisecondCount [
"Answer a Delay waiting for millisecondCount milliseconds after startup"
"Answer a Delay waiting until millisecondCount milliseconds after startup"

<category: 'instance creation'>
^self new initUntilMilliseconds: millisecondCount
^self untilMilliseconds: millisecondCount * 1000000
]

Delay class >> activeDelay [
Expand Down Expand Up @@ -101,7 +115,7 @@ created.'>

"Signal any expired delays"
[activeDelay := self activeDelay.
activeDelay notNil and: [Time millisecondClockValue >= activeDelay resumptionTime]]
activeDelay notNil and: [Time nanosecondClockValue >= activeDelay resumptionTime]]
whileTrue:
[activeDelay signal.
self unscheduleDelay: activeDelay].
Expand All @@ -112,9 +126,9 @@ created.'>
TimeoutSem initialize.

"And signal when the next request is due."
self activeDelay isNil ifFalse: [
nextTick := activeDelay resumptionTime - Time millisecondClockValue.
Processor signal: TimeoutSem atMilliseconds: nextTick].
activeDelay isNil ifFalse: [
nextTick := activeDelay resumptionTime + Time.ClockOnStartup.
Processor signal: TimeoutSem atNanosecondClockValue: nextTick].
]

Delay class >> runDelayProcess [
Expand Down Expand Up @@ -312,7 +326,7 @@ created.'>
"Prepare to wait on the delay."
<category: 'private'>
resumptionTime isNil
ifTrue: [ resumptionTime := Time millisecondClockValue + delayDuration ].
ifTrue: [ resumptionTime := Time nanosecondClockValue + delayDuration ].
]

reset [
Expand All @@ -339,7 +353,7 @@ created.'>
answer the receiver if it is already waiting until an absolute time."
<category: 'accessing'>
self isAbsolute ifTrue: [ ^self ].
^Delay untilMilliseconds: Time millisecondClockValue + delayDuration.
^Delay untilNanoseconds: Time nanosecondClockValue + delayDuration.
]

postCopy [
Expand All @@ -356,22 +370,22 @@ created.'>
<category: 'accessing'>
^resumptionTime isNil
ifTrue: [ delayDuration ]
ifFalse: [ (resumptionTime - Time millisecondClockValue) max: 0 ]
ifFalse: [ (resumptionTime - Time nanosecondClockValue) max: 0 ]
]

basicDelayDuration [
<category: 'private'>
^delayDuration
]

initForMilliseconds: value [
initForNanoseconds: value [
"Initialize a Delay waiting for millisecondCount milliseconds"

<category: 'initialization'>
delayDuration := value
]

initUntilMilliseconds: value [
initUntilNanoseconds: value [
"Initialize a Delay waiting for millisecondCount milliseconds after startup"

<category: 'instance creation'>
Expand Down
7 changes: 4 additions & 3 deletions kernel/ProcSched.st
Expand Up @@ -350,11 +350,12 @@ Object subclass: ProcessorScheduler [

]

signal: aSemaphore atMilliseconds: millis [
"Private - signal 'aSemaphore' after 'millis' milliseconds have elapsed"
signal: aSemaphore atNanosecondClockValue: ns [
"Private - signal 'aSemaphore' when the nanosecond clock reaches
'ns' nanoseconds."

<category: 'timed invocation'>
<primitive: VMpr_Processor_signalAtMilliseconds>
<primitive: VMpr_Processor_signalAtNanosecondClockValue>
^self primitiveFailed
]

Expand Down
5 changes: 4 additions & 1 deletion kernel/Random.st
Expand Up @@ -163,7 +163,10 @@ floating point values between 0 and 1.'>
"Private - Set a random number seed."

<category: 'private'>
self setSeed: (Time primSecondClock - Time primMillisecondClock) abs.
| seed |
seed := Time primSecondClock bitXor: Time millisecondClock.
seed := seed + (Time primNanosecondClock \\ 1000000).
self setSeed: seed
]
]

31 changes: 25 additions & 6 deletions kernel/Time.st
Expand Up @@ -122,18 +122,25 @@ time value, and a block execution timing facility.'>
^self primitiveFailed
]

Time class >> nanosecondClock [
"Answer the number of nanoseconds since startup."

<category: 'clocks'>
^self primNanosecondClock - ClockOnStartup
]

Time class >> millisecondClock [
"Answer the number of milliseconds since startup."

<category: 'clocks'>
^self primMillisecondClock - ClockOnStartup
^self nanosecondClock // 1000000
]

Time class >> primMillisecondClock [
Time class >> primNanosecondClock [
"Returns the number of milliseconds since midnight."

<category: 'builtins'>
<primitive: VMpr_Time_millisecondClock>
<primitive: VMpr_Time_nanosecondClock>
^self primitiveFailed
]

Expand All @@ -154,9 +161,9 @@ time value, and a block execution timing facility.'>
<category: 'initialization'>
| time |
aspect == #returnFromSnapshot ifTrue: [
ClockOnStartup := Time primMillisecondClock - ClockOnImageSave].
ClockOnStartup := Time primNanosecondClock - ClockOnImageSave].
aspect == #aboutToSnapshot ifTrue: [
ClockOnImageSave := Time millisecondClock].
ClockOnImageSave := Time nanosecondClock].
]

Time class >> now [
Expand Down Expand Up @@ -258,11 +265,18 @@ time value, and a block execution timing facility.'>
^self fromSeconds: (hms at: 1) * 3600 + ((hms at: 2) * 60) + (hms at: 3)
]

Time class >> nanosecondClockValue [
"Answer the number of milliseconds since startup"

<category: 'clocks'>
^self primNanosecondClock - ClockOnStartup
]

Time class >> millisecondClockValue [
"Answer the number of milliseconds since startup"

<category: 'clocks'>
^self primMillisecondClock - ClockOnStartup
^self nanosecondClockValue // 1000000
]

Time class >> millisecondsPerDay [
Expand All @@ -282,6 +296,11 @@ time value, and a block execution timing facility.'>
^self millisecondClock - startTime
]

asNanoseconds [
<category: 'accessing (non ANSI & for Durations)'>
^seconds * 1000000000
]

asMilliseconds [
<category: 'accessing (non ANSI & for Durations)'>
^seconds * 1000
Expand Down
44 changes: 44 additions & 0 deletions libgst/ChangeLog
@@ -1,3 +1,47 @@
2012-05-19 Paolo Bonzini <bonzini@gnu.org>

* libgst/events.h: Adjust prototype for _gst_async_timed_wait.
* libgst/prims.def: Switch VMpr_Processor_signalAtMillisecondClockValue
to nanosecond precision, adjust call to _gst_async_timed_wait.
* libgst/sysdep.h: Adjust prototype for _gst_sigalrm_at.
* libgst/sysdep/cygwin/timer.c: Switch _gst_sigalrm_at to nanosecond
precision.
* libgst/sysdep/posix/timer.c: Switch _gst_sigalrm_at to nanosecond
precision.
* libgst/sysdep/win32/events.c: Switch _gst_async_timed_wait to nanosecond
precision.

2012-05-19 Paolo Bonzini <bonzini@gnu.org>

* libgst/events.h: Adjust prototype for _gst_async_timed_wait.
* libgst/interp.c: Use _gst_sigvtalrm_every.
* libgst/prims.def: Pass absolute time to _gst_async_timed_wait.
* libgst/sysdep.h: Remove _gst_signal_after, add _gst_sigvtalrm_every
and _gst_sigalrm_at.
* libgst/sysdep/cygwin/timer.c: Remove _gst_signal_after, add
_gst_sigvtalrm_every and _gst_sigalrm_at.
* libgst/sysdep/posix/events.c: Use _gst_sigalrm_at.
* libgst/sysdep/posix/timer.c: Remove _gst_signal_after, add
_gst_sigvtalrm_every and _gst_sigalrm_at.
* libgst/sysdep/win32/events.c: Get absolute time in
_gst_async_timed_wait.
* libgst/sysdep/win32/timer.c: Do not abort on _gst_sigvtalrm_every,
just do nothing.

2012-05-19 Paolo Bonzini <bonzini@gnu.org>

* libgst/prims.def: Support the new primitive
VMpr_Processor_signalAtMillisecondClockValue.

2012-05-19 Paolo Bonzini <bonzini@gnu.org>

* libgst/prims.def: Add VMpr_Time_nanosecondClock.
* libgst/sysdep.h: Add _gst_get_ns_time.
* libgst/sysdep/common/time.c: Add _gst_get_milli_time.
* libgst/sysdep/posix/time.c: Change _gst_get_milli_time to
_gst_get_ns_time.
* libgst/sysdep/win32/time.c: Likewise.

2012-03-30 Gwenael Casaccio <mrgwen@gmail.com>

* libgst/oop.c: Allocate large objects from fixedspace.
Expand Down
7 changes: 4 additions & 3 deletions libgst/events.h
Expand Up @@ -72,10 +72,11 @@ extern void _gst_async_interrupt_wait (OOP semaphoreOOP,

/* These are defined in sysdep/.../events.c. */

/* Arrange so that after DELAY milliseconds SEMAPHOREOOP is signaled
by the virtual machine. Previous waits are discarded. */
/* Arrange so that when the nanosecond clock reaches NSTIME,
SEMAPHOREOOP is signaled by the virtual machine. Previous waits
are discarded. */
extern void _gst_async_timed_wait (OOP semaphoreOOP,
int delay)
int64_t nsTime)
ATTRIBUTE_HIDDEN;

/* Answer whether a timeout has been scheduled and a semaphore was
Expand Down
2 changes: 1 addition & 1 deletion libgst/interp.c
Expand Up @@ -2352,7 +2352,7 @@ set_preemption_timer (void)

time_to_preempt = false;
if (timeSlice > 0)
_gst_signal_after (timeSlice, preempt_smalltalk_process, SIGVTALRM);
_gst_sigvtalrm_every (timeSlice, preempt_smalltalk_process);
#endif
}

Expand Down

0 comments on commit 8cc8bfc

Please sign in to comment.