Author: chromatic
Date: Tue Mar 13 15:31:21 2007
New Revision: 17472
Modified:
trunk/docs/stm/howto.pod
trunk/src/dod.c
trunk/src/gc_gms.c
trunk/src/pmc/stmlog.pmc
trunk/src/register.c
trunk/src/stm/backend.c
Log:
Minor typo fixes in comments. Try to guess what I've been reading lately.
Modified: trunk/docs/stm/howto.pod
==============================================================================
--- trunk/docs/stm/howto.pod (original)
+++ trunk/docs/stm/howto.pod Tue Mar 13 15:31:21 2007
@@ -7,20 +7,20 @@
The Parrot STM (software transactional memory) system provides
transactional access to PMCs in a thread-safe way. Like database
transactions, STM transactions logically occur either all at once or not
-at all. Note that the STM system only provides such gaurentees for reads
+at all. Note that the STM system only provides such guarantees for reads
and writes made on references to PMCs managed by STM. In practice, STM
-uses optimisitic concurrency control, meaning that STM may discover that
+uses optimistic concurrency control, meaning that STM may discover that
a transaction is not valid after the code implementing it runs and need
to rerun it. The STM-related side effects of the failed transaction will
not be seen. It is your responsibility to prevent other side effects
-from occuring.
+from occurring.
=head2 STM-managed references
STM provides two types of references to PMCs: STMVars, in which read
and write operations are explicit, and STMRefs, which attempt to act
like a 'normal' PMC. Their full interfaces are documented in
-C<docs/stm/stm_frontend.pod>. You can provide another thread with
+L<docs/stm/stm_frontend.pod>. You can provide another thread with
STMVar and STMRef instances you created by passing them as arguments
to the thread's starting function or by passing them through an STMVar
or STMRef.
@@ -85,15 +85,15 @@
to provide the desired flow control without needing to capture explicit
continuations (or use exceptions). Exception support is currently not
present in the library because exception support was not stable at the
-time it was written. It is compiled to C<STM.pbc> and is contained
+time it was written. It is compiled to F<STM.pbc> and is contained
entirely in the C<parrot;STM> namespace. The library is implemented
-using the STM opcodes documented in C<src/ops/stm.ops> and using the
+using the STM opcodes documented in F<src/ops/stm.ops> and using the
STMLog PMC type.
=head2 Starting and ending transactions
The runtime library C<transaction> runs a supplied subroutine (with
-optional supplied arugments) in a seperate transaction commiting the
+optional supplied arugments) in a separate transaction commiting the
result. For example, (Perlish) psuedocode for inserting at the beginning
of a linked list might look like this:
@@ -111,7 +111,7 @@
})
The supplied closure will be run in a seperate transaction until it
-commits successfully. STM will guarentee that other threads see the
+commits successfully. STM will guarantee that other threads see the
transaction as taking place all at once (so, e.g., C<defined
$list.head.get_read().prev.get_read()> will always be false in another
thread's transaction).
@@ -127,13 +127,13 @@
retval = subtocall(args :flat)
stm_commit start_label # goes to start_label if commit fails
.return (retval)
- .end
+ .end
However, it is more complicated in order to support other operations
mentioned below.
One cannot use writing operations on an STMRef (except for setref) or
-the 'get_update' method on STMVar without an active transaction. For
+the C<get_update> method on STMVar without an active transaction. For
programming convenience, if other operations occur outside any
transaction, it will be as if each operation occured in its own
transaction. This, of course, is only suitable for situations where, if
@@ -184,10 +184,10 @@
remove a value on one of several (STM-using) lists using code like:
my $value = STM::choice(
- sub { return $list1.removeTail() },
+ sub { return $list1.removeTail() },
sub { return $list2.removeTail() },
...
- );
+ );
This will not block if either of the lists has a value available
and will properly wait for either list to have a value available if
@@ -196,7 +196,7 @@
=head2 Rolling back transactions
For cases when one detects an error during a transaction, the runtime
-provides the function give_up() which tells transaction() to rollback
+provides the function C<give_up()> which tells C<transaction()> to rollback
(using the C<stm_abort> op) the transaction when it regains but still
return whatever the subroutine did:
@@ -249,16 +249,16 @@
and then use it in something like:
my $value = STM::choice(
- sub { findValue() },
+ sub { findValue() },
sub { $other_list.removeTail() }
);
In the implementation of the runtime library or equivalents some extra
effort is needed to deal properly with nesting though this is
transparent to the user. Most importantly, an inner transaction might
-fail to commit (and instead do something like call retry()) repeatedly
+fail to commit (and instead do something like call C<retry()>) repeatedly
because the outer transaction constrains it to seeing an outdated view
-of objects. To compensate for this, one must check ifthe outer
+of objects. To compensate for this, one must check if the outer
transaction is invalid, which can be done explicitly using the
C<stm_validate> op and which is always done by C<stm_wait>, and, if it
is, rollback and restart the outer transaction.
Modified: trunk/src/dod.c
==============================================================================
--- trunk/src/dod.c (original)
+++ trunk/src/dod.c Tue Mar 13 15:31:21 2007
@@ -875,7 +875,7 @@
=item C<void
-Parrot_dod_ms_run_init(Interp *interp, UINTVAL flags)>
+Parrot_dod_ms_run_init(Interp *interp)>
Prepare for a mark & sweep DOD run.
@@ -927,9 +927,9 @@
if (interp->debugger) {
/*
* if the other interpreter did a DOD run, it can set
- * life bits of shared objects, but these aren't reset, because
+ * live bits of shared objects, but these aren't reset, because
* they are in a different arena. When now such a PMC points to
- * other non-shared object, these wouldn't be marked amd hence
+ * other non-shared object, these wouldn't be marked and hence
* collected.
*/
Parrot_dod_clear_live_bits(interp);
Modified: trunk/src/gc_gms.c
==============================================================================
--- trunk/src/gc_gms.c (original)
+++ trunk/src/gc_gms.c Tue Mar 13 15:31:21 2007
@@ -683,7 +683,7 @@
/*
* TODO check old - its overwritten, increment overwrite count,
- * if its an aggregate all contents *may* be dead now, so
+ * if it's an aggregate all contents *may* be dead now, so
* increment overwrite count by elements
*/
}
@@ -1024,7 +1024,7 @@
if (priority)
++interp->arena_base->num_early_PMCs_seen;
h = PObj_to_GMSH(obj);
- /* unsnap it from white, put it into grey or black */
+ /* unsnap it from white, put it into gray or black */
if (PObj_is_PMC_TEST(obj) && ((PMC*)obj)->pmc_ext)
gc_gms_setto_gray(interp, h, priority);
else
Modified: trunk/src/pmc/stmlog.pmc
==============================================================================
--- trunk/src/pmc/stmlog.pmc (original)
+++ trunk/src/pmc/stmlog.pmc Tue Mar 13 15:31:21 2007
@@ -9,7 +9,7 @@
=head1 DESCRIPTION
This PMC class holds an STM transaction log that can be replayed.
-Replaying is only gaurenteed to be implemented enough to allow
+Replaying is only guaranteed to be implemented enough to allow
choice (Haskell `orElse`) to be implemented.
This PMC will copy the current the transaction's log when it
Modified: trunk/src/register.c
==============================================================================
--- trunk/src/register.c (original)
+++ trunk/src/register.c Tue Mar 13 15:31:21 2007
@@ -139,7 +139,7 @@
=item C<void parrot_gc_context(Interp *)>
-Cleanup dead context memory. Called by the gargabe collector.
+Cleanup dead context memory. Called by the garbage collector.
=item C<parrot_context_t* Parrot_alloc_context(Interp *, INTVAL *n_regs_used)>
Modified: trunk/src/stm/backend.c
==============================================================================
--- trunk/src/stm/backend.c (original)
+++ trunk/src/stm/backend.c Tue Mar 13 15:31:21 2007
@@ -10,7 +10,7 @@
This file implements the non-user-visible parts of the Software
Transactional Memory implementation, including handling of all
-the low-level synchornization.
+the low-level synchronization.
=head2 Functions
@@ -1261,7 +1261,7 @@
=item C<void Parrot_STM_replay_extracted(Interp *interp, void *saved_log_data)>
Replay a transaction log extracted with C<Parrot_STM_extract>. At the moment
-this is only gaurenteed to work well enough to use STM_wait(). If one
+this is only guaranteed to work well enough to use STM_wait(). If one
attempts to use it to replay transactions to commit them, it is likely to
produce wrong results if the recorded transaction had dependencies on its outer
transactions and it is not replayed inside the same transactions it was
recorded
@@ -1277,6 +1277,9 @@
int i;
STM_tx_log_sub *sublog;
+ if (saved_log_data == NULL)
+ return;
+
saved = saved_log_data;
log = Parrot_STM_tx_log_get(interp);
@@ -1284,16 +1287,13 @@
if (log->depth == 0)
internal_exception(1, "replay_extracted outside of transaction");
- if (saved == NULL)
- return;
-
sublog = get_sublog(log, log->depth);
start = log->last_read;
for (i = 0; i < saved->num_reads; ++i)
*(alloc_read(interp, log)) = saved->reads[i];
- start = log->last_write;
+ start = log->last_write;
for (i = 0; i < saved->num_writes; ++i) {
STM_write_record *write;
int successp;