diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-04-07 13:59:44 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-04-07 13:59:44 +0000 |
commit | c64117400e17cceb1b6e489167a71261297a7b4c (patch) | |
tree | b942bbc7350b26f202312f0ba35f942b197d0618 /src/actors | |
parent | 88bcc5c05b3abca7c2f09c59cbeceff0ab892fca (diff) | |
download | scala-c64117400e17cceb1b6e489167a71261297a7b4c.tar.gz scala-c64117400e17cceb1b6e489167a71261297a7b4c.tar.bz2 scala-c64117400e17cceb1b6e489167a71261297a7b4c.zip |
Merged revisions 20582,20586,20597-20603,20607-...
Merged revisions
20582,20586,20597-20603,20607-20615,20619,20623-20625,20629-20631,20634-
20635,20639-20640,20644-20646,20649-20651,20654-20664,20672-20673,20675-
20678,20681-20683,20687-20690,20692-20693,20704-20705,20707,20710-20714,
20716,20718,20720,20723-20724,20727-20730,20734-20735,20738-20740,20744-
20745,20748,20750-20753,20756-20757,20761,20763,20767-20769,20771-20772,
20776-20781,20783,20785,20787-20791,20793-20798,20802-20803,20805-20807,
20812,20816,20818,20826,20828-20832,20834-20835,20840,20842-20844,20849-
20852,20854-20858,20862-20864,20866-20867,20869,20872-20874,20878-20881,
20884-20889,20894-20901,20905-20909,20911-20913,20917-20918,20920-20922,
20928-20929,20932-20938,20941-20942,20944-20945,20949-20970,20972-20974,
20976-21001,21003-21024,21027-21029,21031,21043-21045,21053-21054,21058-
21060,21062-21068,21071,21073-21081,21083-21088,21091-21094,21098-21103,
21105-21111,21113,21115,21121,21123-21131,21135-21142,21148-21151,21156-
21160,21162-21165,21167-21168,21171,21174-21181,21184,21186-21190,21193,
21195-21196,21199-21201,21205-21207,21210,21214-21220,21222-21250,21252-
21254,21256-21266,21269,21271,21273-21276,21278-21292,21294-21297,21299,
21303-21305,21307,21309,21313,21322-21333,21341-21351,21353-21354,21356
via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk
........
r20582 | extempore | 2010-01-18 22:18:36 +0100 (Mon, 18 Jan 2010) | 3 lines
More work consolidating the XML code needlessly duplicated between
the compiler and the library. Having to fix #2354 in two completely
different places was I found very motivating. ........ r20586 |
extempore | 2010-01-19 04:15:07 +0100 (Tue, 19 Jan 2010) | 14 lines
Digging into why the repl is so slow, discovered that fsc is once
again never reusing compiler instances (but for a different reason
than #1683.) Small changes break equality and the little troopers
are so darn quiet about it. Steady state, hot fsc repl startup times
before this patch:
0m1.747s 0m1.789s 0m1.842s 0m1.690s
After this patch:
0m1.139s 0m1.148s 0m1.090s 0m1.091s
No review. Could use a test case but I have trouble coaxing partest
this far outside the box. ........ r20597 | dubochet | 2010-01-19
11:52:43 +0100 (Tue, 19 Jan 2010) | 1 line
[scaladoc] Search tool will ignore case for lowercase-only queries.
Type return when search tool is active to immediately search and display
the first result. Contributed by Johannes Rudolph. Also: removed useless
`DocProvider` class. No review, checked by dubochet. ........ r20598 |
dragos | 2010-01-19 14:21:03 +0100 (Tue, 19 Jan 2010) | 2 lines
Fixed isClosureClass in inliner and removed it from CopyPropagation
(was dead code). See #2893. ........ r20599 | odersky | 2010-01-19
17:44:20 +0100 (Tue, 19 Jan 2010) | 1 line
more performance improvements; eliminated mk...Type function in Types.
........ r20600 | extempore | 2010-01-19 19:04:23 +0100 (Tue, 19 Jan
2010) | 2 lines
Added test to pending with extensive exploration of behaviors of
instanceOf as compared with type matching. ........ r20601 | extempore |
2010-01-19 19:24:29 +0100 (Tue, 19 Jan 2010) | 2 lines
Iterators created with duplicate compare equal if they are positioned
at the same element. Review by community. ........ r20602 | extempore |
2010-01-19 20:28:17 +0100 (Tue, 19 Jan 2010) | 4 lines
Until now all scala builds performed not in an svn tree were given
no version number, because the version was extracted from "svn info".
Now it tries git style if svn info is unrevealing. Review by community.
........ r20603 | extempore | 2010-01-19 20:41:41 +0100 (Tue, 19 Jan
2010) | 1 line
Test case for #2148. Closes #2148, no review.
........
r20607 | extempore | 2010-01-20 01:27:53 +0100 (Wed, 20 Jan 2010) | 5 lines
Made some cosmetic but clarity-increasing changes to a few files.
Primarily, used corresponds where possible rather than zipped.forall.
Added isImplicit and isJava to MethodType so the relevant subtypes
could be determined without the hideous isInstanceOf checks. Review by
odersky. ........ r20608 | extempore | 2010-01-20 01:28:09 +0100 (Wed,
20 Jan 2010) | 1 line
Fix for #2927. No review.
........
r20609 | extempore | 2010-01-20 03:36:37 +0100 (Wed, 20 Jan 2010) | 1 line
Un-overloaded StringLike.format. Closes #2898. No review. ........
r20610 | extempore | 2010-01-20 03:36:51 +0100 (Wed, 20 Jan 2010) | 1
line
Removed some debugging echoes I let slip through. ........ r20611 |
extempore | 2010-01-20 05:38:32 +0100 (Wed, 20 Jan 2010) | 2 lines
Took a slightly different tack on parsing the svn version. No review.
........ r20612 | extempore | 2010-01-20 06:50:37 +0100 (Wed, 20 Jan
2010) | 6 lines
No longer are there more IDE-specific junk files in the root directory
of the official scala repository than actual scala files and directories
put together. It's a truly awful first impression to give potential
developers so I'm interpreting the non-response regarding the need for
them as quiet encouragement to put them in src/intellij. Review by
ilyas. ........ r20613 | extempore | 2010-01-20 06:50:51 +0100 (Wed, 20
Jan 2010) | 2 lines
Bringing README up to date and filling in some of the info gaps.
Review by cunei. ........ r20614 | extempore | 2010-01-20 06:51:12 +0100
(Wed, 20 Jan 2010) | 4 lines
Removed static state from global object ClassPath object, and some
minor repositioning while in there. Closes #2928, but the intentions
behind -optimise being intertwined with ClassPath could really use
some source comments. Review by rytz. ........ r20615 | milessabin |
2010-01-20 10:12:10 +0100 (Wed, 20 Jan 2010) | 1 line
Renamed new bin directory to "tools" to avoid conflict with Eclipse
incremental build output directory. ........ r20619 | rytz | 2010-01-20
11:55:56 +0100 (Wed, 20 Jan 2010) | 1 line
fixed bugs in .NET bytecode generation (branching out of try / catch /
finally blocks is not allowed). predef.dll now almost passes PEVerify.
no review ........ r20623 | dubochet | 2010-01-20 15:41:58 +0100 (Wed,
20 Jan 2010) | 1 line
[scaladoc] Default values of parameters are documented. Tags
"@author", "@see", "@since", "@version", and "@deprecated" are displayed
in documentation. Contributed by Pedro Furlanetto, checked by dubochet,
no review. ........ r20624 | plocinic | 2010-01-20 18:15:49 +0100 (Wed,
20 Jan 2010) | 1 line
Closes #2653, #2652, #2556. The last one required more sophisticated
mechanism for detecting invalid references to inherited members, but
at least it doesn't seem to cause unnecessary recompilations. ........
r20625 | odersky | 2010-01-20 19:29:13 +0100 (Wed, 20 Jan 2010) | 2
lines
Attempt to fix #2926 (companion object of case class problem in
Eclipse) ........ r20629 | odersky | 2010-01-21 20:27:39 +0100 (Thu, 21
Jan 2010) | 1 line
Fix for #2867 undone, review by extempore.
........
r20630 | extempore | 2010-01-21 21:52:32 +0100 (Thu, 21 Jan 2010) | 1 line
Moved test case for just-reverted patch to pending. No review.
........ r20631 | extempore | 2010-01-21 22:00:08 +0100 (Thu, 21 Jan
2010) | 17 lines
It's a big REPL patch. And it contains:
* Eliminated a bug which was causing all repl lines to be parsed twice
* Removed reference to JLine from InterpreterLoop which was causing someone trouble in eclipse
* Enriched the repl compile/reflect mechanism to allow retrieving the value as well as the String describing it
* Utilized said enrichment to write an eval[T] method which is exposed in the repl in :power mode
* Added ability to turn off string unwrapping in repl: settings.unwrapStrings = false
* Created interface presently called Completion.Special which lets objects define their own contents
* As minor demonstration of above, in :power mode variable "repl" implements Special and completes with all repl identifiers
* As more interesting demonstration of above, try a repl session like...
import scala.tools.nsc.interpreter.Completion.Special import
scala.tools.nsc.io.Process
val connections = new Special { def tabCompletions() = Process("netstat -p tcp").toList drop 2 map (_ split "\\s+" apply 4) }
connections.<tab>
Review by community!
........
r20634 | odersky | 2010-01-22 17:50:55 +0100 (Fri, 22 Jan 2010) | 1 line
Second attempt to fix #2926. Reverted first attempt. review by
milessabin. ........ r20635 | rytz | 2010-01-22 17:55:23 +0100 (Fri, 22
Jan 2010) | 1 line
fix several issues in .net backend / type parsing. allow re-building
forkjoin.jar separately. no review ........ r20639 | odersky |
2010-01-23 18:44:20 +0100 (Sat, 23 Jan 2010) | 2 lines
Closes 2926. Review by milesabin.
........
r20640 | extempore | 2010-01-23 21:30:01 +0100 (Sat, 23 Jan 2010) | 9 lines
Another big REPL patch. Lacking the time right now to write a proper
commit message, I will just say it adds a couple of pretty frabjous
features, in addition to cleaning up a whole bunch of questionable
code.
* Tab-completion now chains through intermediate results on fields and 0-arg methods
* You can now define custom Completors which define their own contents.
Details and demos to come in a wiki document about the repl. ........
r20644 | extempore | 2010-01-24 01:31:38 +0100 (Sun, 24 Jan 2010) | 2
lines
Some minor polishing to the previous repl completion patch, plus a few
new features and improvements. ........ r20645 | odersky | 2010-01-24
16:05:46 +0100 (Sun, 24 Jan 2010) | 2 lines
renamed notCompiles ==> canRedefine. Made code completion more robust.
........ r20646 | extempore | 2010-01-24 16:19:55 +0100 (Sun, 24 Jan
2010) | 1 line
Removing a stray paren to unbreak build. No review. ........ r20649 |
dragos | 2010-01-24 19:15:23 +0100 (Sun, 24 Jan 2010) | 2 lines
Fixed dead code elimination to satisfy YourKit's instrumentation:
a drop for a newly initialized object is always added after the
constructor call, instead of immediately after a DUP ........ r20650 |
plocinic | 2010-01-24 23:57:30 +0100 (Sun, 24 Jan 2010) | 1 line
Added new target for partest for testing Build Manager behaviour.
Updated Refined Build Manager for consistency. --buildmanager requires
the test file that describes actions to be done on the refined build
manager (compiling files, making changes to the classes), sources of
changes, the check file and the initial scala source files. Cleaned up
some code in partest, refactored some obvious code duplication. Tests
to follow... Review by phaller. ........ r20651 | plocinic | 2010-01-25
00:00:02 +0100 (Mon, 25 Jan 2010) | 1 line
First test for buildmanager. No review necessary
........
r20654 | plocinic | 2010-01-25 11:28:11 +0100 (Mon, 25 Jan 2010) | 1 line
Fix ant task for build manager partest. no review. ........ r20655 |
rytz | 2010-01-25 11:44:16 +0100 (Mon, 25 Jan 2010) | 1 line
small improvements in building newlibs / newforkjoin. no review.
........ r20656 | dubochet | 2010-01-25 12:31:44 +0100 (Mon, 25 Jan
2010) | 1 line
[scaladoc] Deprecated methods are striked-out. There is an `implict`
keyword in front of implicit parameters. Fixed an issue with inherited
constructors printed in documentation. Contributed by Pedro Furlanetto,
checked by dubochet, no review. ........ r20657 | dragos | 2010-01-25
13:43:40 +0100 (Mon, 25 Jan 2010) | 2 lines
Fixed #2497: replaceInstruction now uses reference equality. No review
necessary. ........ r20658 | rytz | 2010-01-25 15:20:52 +0100 (Mon, 25
Jan 2010) | 1 line
close #2929. review by community (see typedValDef in Typers.scala, the
BYNAMEPARAM flag was missing). ........ r20659 | dubochet | 2010-01-25
15:23:36 +0100 (Mon, 25 Jan 2010) | 1 line
[scaladoc] Classes `FunctionX`, `ProductX`, and `TupleX`, for `X`
greater than 2, are not listed. Contributed by Pedro Furlanetto, checked
by dubochet, no review. ........ r20660 | milessabin | 2010-01-25
17:14:02 +0100 (Mon, 25 Jan 2010) | 1 line
Use file paths for equality and hashCode to deal with mixed-type file
equality test issues in the IDE. Fixes #2931. ........ r20661 | prokopec
| 2010-01-25 19:21:04 +0100 (Mon, 25 Jan 2010) | 2 lines
Replacement in matching can now be done by providing function
arguments for replacement. Fixes #2761. Review by phaller. ........
r20662 | prokopec | 2010-01-25 19:21:32 +0100 (Mon, 25 Jan 2010) | 1
line
Test file for matching with replace.
........
r20663 | odersky | 2010-01-25 19:32:56 +0100 (Mon, 25 Jan 2010) | 1 line
Fixed stability problem with build.
........
r20664 | prokopec | 2010-01-25 20:22:06 +0100 (Mon, 25 Jan 2010) | 1 line
Fixes #2766. Review by phaller.
........
r20672 | plocinic | 2010-01-26 11:03:04 +0100 (Tue, 26 Jan 2010) | 1 line
Changed the info statements in refined build manager to print the
information in more consistent way, so that we can test it using
partest. Added more tests for build manager, more to follow... No
review. ........ r20673 | plocinic | 2010-01-26 11:33:10 +0100 (Tue, 26
Jan 2010) | 1 line
More tests, plus missing file. No review.
........
r20675 | plocinic | 2010-01-26 14:38:38 +0100 (Tue, 26 Jan 2010) | 1 line
Hack for the refined build manager to print info in a deterministic
way. No review. ........ r20676 | prokopec | 2010-01-26 15:03:19 +0100
(Tue, 26 Jan 2010) | 1 line
Access modifiers added for certain members and some refactoring in
Regex. ........ r20677 | dubochet | 2010-01-26 15:03:24 +0100 (Tue, 26
Jan 2010) | 1 line
Fixed a number of faulty Scaladoc comments in library and compiler
sources. No review. ........ r20678 | plocinic | 2010-01-26 15:21:58
+0100 (Tue, 26 Jan 2010) | 1 line
Another batch of tests. No review.
........
r20681 | extempore | 2010-01-26 23:14:15 +0100 (Tue, 26 Jan 2010) | 13 lines
Refinements to the recent repl patches. You can now complete on a few
more things, like literals (1.<tab>, "abc".<tab>). A completion aware
case class walker which leverages the names of the case fields for
completion. For instance:
:power
val x = new ProductCompletion(mkTree("def f(x: Int, y: Int) = f(5, 10) + f(10, 20)")
x.<tab>
mods name rhs tparams tpt vparamss
x.rhs.fun.<tab>
name qualifier
scala> x.rhs.fun.qualifier
res3: scala.tools.nsc.ast.Trees$Apply = f(5, 10)
........
r20682 | plocinic | 2010-01-27 00:01:41 +0100 (Wed, 27 Jan 2010) | 1 line
Refactored some of the code from r20624 thanks to Iulian's review.
........ r20683 | plocinic | 2010-01-27 00:08:20 +0100 (Wed, 27 Jan
2010) | 1 line
Cleaning up. No review.
........
r20687 | phaller | 2010-01-27 10:07:56 +0100 (Wed, 27 Jan 2010) | 1 line
Made actor-receivewithin test deterministic.
........
r20688 | rytz | 2010-01-27 11:23:31 +0100 (Wed, 27 Jan 2010) | 1 line
close #2868. problem was: when the same constant is used in a
ConstantType and a LiteralAnnotArg, it is stored inside the unpickle
cache 'entries' (see 'def at' in UnPickler) once as Constant, once as
LiteralAnnotArg, resulting in a CCE for the second read. review by
extempore. ........ r20689 | rytz | 2010-01-27 11:28:52 +0100 (Wed, 27
Jan 2010) | 1 line
fix pickle format doc. no review
........
r20690 | rytz | 2010-01-27 12:08:54 +0100 (Wed, 27 Jan 2010) | 1 line
reverting r20688 for now, no review
........
r20692 | plocinic | 2010-01-27 13:56:24 +0100 (Wed, 27 Jan 2010) | 1 line
Closes #2966. Review by milessabin.
........
r20693 | plocinic | 2010-01-27 14:15:16 +0100 (Wed, 27 Jan 2010) | 1 line
Forgot to commit the change. No review.
........
r20704 | rytz | 2010-01-27 15:12:28 +0100 (Wed, 27 Jan 2010) | 1 line
now correctly fix #2868. no review
........
r20705 | extempore | 2010-01-27 17:53:36 +0100 (Wed, 27 Jan 2010) | 1 line
Fix for #2563. Review by mharrah.
........
r20707 | extempore | 2010-01-27 22:27:22 +0100 (Wed, 27 Jan 2010) | 1 line
Some hardening of repl generated code. No review. ........ r20710 |
extempore | 2010-01-28 06:46:06 +0100 (Thu, 28 Jan 2010) | 6 lines
One of those "$.05 for the bolt, $50,000 for knowing where to put it"
commits. Closes #425, #816, #2310, #2691. All credit for this patch goes
to me for having the genius to know when new eyes were needed (although
if you're feeling generous some could also go to walter korman for the
actual debugging and code writing part.) ........ r20711 | extempore |
2010-01-28 06:46:36 +0100 (Thu, 28 Jan 2010) | 5 lines
Moved some test cases from pending to files since the bugs they were
watching for seem to be fixed. Moved some other test cases from pending
to disabled because they deceptively claim to pass while investigation
reveals the ticket needs to remain open. Closes #1996, #2660. ........
r20712 | rytz | 2010-01-28 11:26:00 +0100 (Thu, 28 Jan 2010) | 1 line
close #2886 (applied patch). no review
........
r20713 | dubochet | 2010-01-28 11:48:38 +0100 (Thu, 28 Jan 2010) | 6 lines
[scaladoc] Comment parsing is improved:
* tags in code blocks no longer confuse the parser;
* `@note` and `@example` are recognised tags;
* Empty comments no longer generate "must start with a sentence" warnings;
* `@usecase` parsing works better in some situations with blank comment lines above or below.
No review.
........
r20714 | dubochet | 2010-01-28 11:48:53 +0100 (Thu, 28 Jan 2010) | 1 line
[scaladoc] In HTML documentation, `@return` tag is printed also when
there is no `@param` tag present. No review. ........ r20716 | rytz |
2010-01-28 15:14:20 +0100 (Thu, 28 Jan 2010) | 1 line
Removing defaultGetter field from TermSymbols. review by odersky (see
'def defaultGetter' in typechecker/NamesDefaults.scala) ........ r20718
| extempore | 2010-01-28 17:16:22 +0100 (Thu, 28 Jan 2010) | 9 lines
Added :search to power mode for finding classes on the classpath
by regular expression, plus a bunch of compiler hacker convenience
methods to the repl. Now after :power you can:
mkContext() // Context
mkUnit("class Q") // CompilationUnit
mkTypedTree("class A { val x = 5 }") // Tree after phase typer
mkType("java.util.Map") // Type object
... and many more. No review.
........
r20720 | extempore | 2010-01-28 23:55:42 +0100 (Thu, 28 Jan 2010) | 2 lines
Added a command line option for desugaring match blocks differently
for debugging purposes. No review. ........ r20723 | extempore |
2010-01-29 01:37:07 +0100 (Fri, 29 Jan 2010) | 6 lines
I'm sure I'm not the only one driven into paroxysms of annoyance
at the fact that repl transcripts are not at all usable in the repl.
No longer: now you can paste a transcript into the repl and it will
automatically detect it as such, clean it up and replay it. It is
triggered by the "scala> " on the first line of the transcript. Review
by community. ........ r20724 | plocinic | 2010-01-29 12:23:52 +0100
(Fri, 29 Jan 2010) | 1 line
Closes #2650. Dependency on type alias requires analysis before
uncurry phase. Added tests. Review by dragos. ........ r20727 | odersky
| 2010-01-29 15:04:06 +0100 (Fri, 29 Jan 2010) | 1 line
new starr to bag performance improvements and fixes to companion
objects ........ r20728 | extempore | 2010-01-29 16:43:41 +0100 (Fri, 29
Jan 2010) | 2 lines
Added hashCode implementations to Manifest types where necessary.
Closes #2838. No review. ........ r20729 | extempore | 2010-01-29
20:11:20 +0100 (Fri, 29 Jan 2010) | 3 lines
Implemented rompf's suggested improvement to the tail recursive
combinators, avoiding re-evaluation of by-name argument. Score one
for code review. No review. (Ironic.) ........ r20730 | extempore |
2010-01-29 20:11:38 +0100 (Fri, 29 Jan 2010) | 3 lines
A few compiler IO lib bits I have been needing: some basic
conveniences for directories and sockets, and some cleanups in
CompileSocket. Review by community. ........ r20734 | extempore |
2010-01-30 07:30:57 +0100 (Sat, 30 Jan 2010) | 6 lines
A compact tree printer, for primitives like myself who do all their
debugging in the console and need extraneous information filtered out.
New option: -Ycompact-trees. Supply that in conjunction with -Xprint:all
and suddenly the output is a (relative) masterpiece of concision. Review
by anyone who is game to review such a thing. Community? ........ r20735
| plocinic | 2010-01-30 18:06:34 +0100 (Sat, 30 Jan 2010) | 1 line
Better test for checking existential types, where symbols not
necessarily have the same name. Added test for that. The problem
manifested itself in Globals.scala for variable classpath causing
execissive compilation without any reason. No review. ........ r20738 |
extempore | 2010-01-31 06:39:25 +0100 (Sun, 31 Jan 2010) | 2 lines
Band-aid for #3004. No review unless you want to take on name mangling
and forwarders, in which case review away. ........ r20739 | extempore |
2010-01-31 17:34:24 +0100 (Sun, 31 Jan 2010) | 4 lines
Great moments in typos: somehow the "decodeUni" in CharArrayReader
had transmogrified into "decodeUnit" in UnitScanner, thus causing
-Xno-uescape to be ignored. Also, removed a now unused -X option. Review
by community. ........ r20740 | extempore | 2010-01-31 17:59:19 +0100
(Sun, 31 Jan 2010) | 2 lines
Solidified the logic of stringOf for repl results printing. Closes
#726. Review by community. ........ r20744 | extempore | 2010-02-01
02:24:11 +0100 (Mon, 01 Feb 2010) | 2 lines
Unbroke the build. Remember kids, "Node extends NodeSeq extends
Seq[Node]" means never having to meet your base case. No review.
........ r20745 | plocinic | 2010-02-01 10:34:28 +0100 (Mon, 01 Feb
2010) | 1 line
Check recursively the type aliases. Closes #2650. Review by dragos.
........ r20748 | odersky | 2010-02-01 16:10:26 +0100 (Mon, 01 Feb 2010)
| 1 line
lifted out core compiler data structures into reflect.generic package.
Made Unpickler work on generic data. ........ r20750 | odersky |
2010-02-01 16:49:33 +0100 (Mon, 01 Feb 2010) | 1 line
missing bits of r20746. For some reasons smartsvn did not show these
before. review by dubochet, extempore. ........ r20751 | extempore |
2010-02-01 17:06:14 +0100 (Mon, 01 Feb 2010) | 3 lines
Removed scala.util.NameTransformer (it moved to reflect.) We don't
have to @deprecate it since it's never been in a released version. No
review. ........ r20752 | plocinic | 2010-02-01 17:16:11 +0100 (Mon, 01
Feb 2010) | 1 line
Exclude anonymous function classes from the definitions in dependency
analysis. This was causing spurious errors in for example Global.scala
and Interpreter.scala because of fresh names numbering. Also cleanup up
some code. No review. ........ r20753 | odersky | 2010-02-01 18:15:05
+0100 (Mon, 01 Feb 2010) | 1 line
suppresses generation of manifests for abstract type members. ........
r20756 | extempore | 2010-02-01 23:35:12 +0100 (Mon, 01 Feb 2010) | 2
lines
Quite a lot more work on completion. The main bit is that file
completion is now avilable, with some caveats. Review by community.
........ r20757 | extempore | 2010-02-02 00:19:33 +0100 (Tue, 02 Feb
2010) | 3 lines
Continuing the fine work creating an abstract interface to the
compiler in scala.reflect.generic, promoted Trees#Traverser and made
the associated changes. Review by odersky. ........ r20761 | plocinic |
2010-02-02 11:36:38 +0100 (Tue, 02 Feb 2010) | 1 line
Cleaned up the code slightly. No review.
........
r20763 | plocinic | 2010-02-02 12:28:56 +0100 (Tue, 02 Feb 2010) | 1 line
Fixed tests. No review.
........
r20767 | phaller | 2010-02-02 13:40:38 +0100 (Tue, 02 Feb 2010) | 1 line
Closes #3009.
........
r20768 | plocinic | 2010-02-02 15:51:03 +0100 (Tue, 02 Feb 2010) | 1 line
Correctly check annotated types. Problem showed up for example in
Interpreter.scala. No review. ........ r20769 | extempore | 2010-02-02
17:46:23 +0100 (Tue, 02 Feb 2010) | 5 lines
Hid some AST nodes from the prying eyes of reflectors. Now Parens,
AssignOrNamedArg, and DocDef are known only to scalac. Also some
cosmetic arranging in the new reflect.generic package, because there's
never a better time than when the code is still warm from the compiler.
Review by odersky. ........ r20771 | extempore | 2010-02-02 20:43:07
+0100 (Tue, 02 Feb 2010) | 9 lines
Took a swing at sorting out sorting. The major components are
rewriting the Sorting methods to accept Orderings and adding a sorted
method to SeqLike, because we should all be pretty tired of writing
".sortWith(_ < _)" by now. I think it should be called "sort", not
"sorted", but that refuses to coexist gracefully with the deprecated
sort in List.
Review by moors (chosen pretty arbitrarily, someone at epfl should
review it but I don't know who deserves the nomination.) ........ r20772
| extempore | 2010-02-02 21:13:28 +0100 (Tue, 02 Feb 2010) | 5 lines
It was pointed out that sorted and the 1-arg version of sortWith are
the same method, one with implicit argument, one without. Since sortWith
has never exist in a release, we can un-overload it (which is a win
anyway) and route everything through sorted. Review by moors. ........
r20776 | plocinic | 2010-02-03 11:22:27 +0100 (Wed, 03 Feb 2010) | 1
line
Fixes the problem mentioned in #2882, which seems to be the reason for #2280 - allow simple ananlysis on java sources. Review by dragos
........
r20777 | extempore | 2010-02-03 16:52:25 +0100 (Wed, 03 Feb 2010) | 2 lines
Made sliding/grouped throw an exception when read past the end. Closes
#3017. ........ r20778 | dubochet | 2010-02-03 18:03:58 +0100 (Wed, 03
Feb 2010) | 1 line
[scaladoc] Optional link to source (set parameter "-doc-source-url").
Support for commenting packages (using package objects). Contributed by
Perdo Furlanetto. Also: small performance improvements, short comment
extraction is more robust (but no HTML tags allowed in first sentence),
small code clean-ups. Checked by dubochet, no review. ........ r20779 |
extempore | 2010-02-03 18:34:31 +0100 (Wed, 03 Feb 2010) | 5 lines
Striking while the iron is hot, renamed removeDuplicates to unique and
deprecated removeDuplicates. The debate between distinct and unique was
vigorous but unique won by a freckle. (Dark horse 'nub' was disqualified
for taking performance enhancers.) The only thing which might need
review is the choice of name, but review by odersky. ........ r20780 |
dpp | 2010-02-03 19:04:50 +0100 (Wed, 03 Feb 2010) | 1 line
Fixed XML Utility.escape method to conform to XML spec. Closes #3014
........ r20781 | dragos | 2010-02-03 19:17:17 +0100 (Wed, 03 Feb 2010)
| 2 lines
Preserve source order for class members in generated bytecode. No
review necessary. ........ r20783 | extempore | 2010-02-03 22:12:56
+0100 (Wed, 03 Feb 2010) | 2 lines
Created MSILGlobal to start breaking the dependency on msil.jar for
those platforms which don't use msil. Review by rytz. ........ r20785 |
extempore | 2010-02-04 00:51:49 +0100 (Thu, 04 Feb 2010) | 7 lines
A big push to make the interpreter easier to instantiate without
having to dodge bullets. It shouldn't have to be any harder than this:
scala> new scala.tools.nsc.Interpreter().evalExpr[Int]("5*5")
res0: Int = 25
...and now it isn't. Review by community.
........
r20787 | extempore | 2010-02-04 13:26:02 +0100 (Thu, 04 Feb 2010) | 3 lines
Noticed that all the system properties were being read into vals so
they didn't notice changes. Determined this was not correct, and changed
them into defs. No review. ........ r20788 | extempore | 2010-02-04
13:26:42 +0100 (Thu, 04 Feb 2010) | 2 lines
Unique's seeming victory is overruled by committee. It is "distinct",
not "unique", wherein lies the nub. No review. ........ r20789 |
extempore | 2010-02-04 14:33:06 +0100 (Thu, 04 Feb 2010) | 5 lines
The remainder of isolating MSIL from the rest of the classpath
code. To accomplish this I made ClassRep an inner class of ClassPath
(which given the broad definition of ClassPath already in place, it
conceptually is already) and as a bonus this allowed dropping its type
parameter. Review by rytz. ........ r20790 | extempore | 2010-02-04
16:22:03 +0100 (Thu, 04 Feb 2010) | 3 lines
Some minor cleanups in reflect. Moved the apply on Traverser back into
the compiler so Traversers can define whatever apply is relevant to
them. No review. ........ r20791 | phaller | 2010-02-04 18:03:57 +0100
(Thu, 04 Feb 2010) | 1 line
Fixed issue in partest where result of tests that timed out was not
printed. Improved reporting. Added support for JUnit report files.
........ r20793 | extempore | 2010-02-04 18:15:18 +0100 (Thu, 04 Feb
2010) | 2 lines
Some hardening in the repl, and removing some functions which now
exist in the standard library. No review. ........ r20794 | extempore |
2010-02-04 19:50:47 +0100 (Thu, 04 Feb 2010) | 6 lines
Raised the level of abstraction (slightly, not enough) on ClassPath
by defining the difference between optimized and regular classpaths in
terms of an arbitrary name filter instead of in terms of settings.XO.
Altered the decision logic to look at the value of -Yinline instead
of -optimise. Closes #2950. Review by rytz. ........ r20795 | rompf |
2010-02-04 20:02:16 +0100 (Thu, 04 Feb 2010) | 1 line
Added byval mode and annotation checker hook for weak lub. Review by
odersky. ........ r20796 | extempore | 2010-02-04 21:21:44 +0100 (Thu,
04 Feb 2010) | 9 lines
Made a whole WithFilter class for Option after discovering this bug:
scala> def f(x: AnyRef) = for (p <- Option(x)) yield p
f: (x: AnyRef)Option[AnyRef]
scala> def f(x: AnyRef) = for (p <- Option(x) ; if true) yield p
f: (x: AnyRef)Iterable[AnyRef]
The for comprehension logic apparently prefers to convert Option to
Iterable to get at the withFilter method over using Option's filter.
........ r20797 | rompf | 2010-02-04 21:52:03 +0100 (Thu, 04 Feb 2010) |
1 line
fixed previous commit. No review.
........
r20798 | extempore | 2010-02-05 00:08:44 +0100 (Fri, 05 Feb 2010) | 1 line
Taking a swing at fixing -optimise. No review.
........
r20802 | dubochet | 2010-02-05 14:12:34 +0100 (Fri, 05 Feb 2010) | 1 line
[scaladoc] Fixed issue with failing Windows build. Code by Pedro
Furlanetto, no review. ........ r20803 | ilyas | 2010-02-05 17:53:41
+0100 (Fri, 05 Feb 2010) | 1 line
some scalap tweaks
........
r20805 | extempore | 2010-02-05 19:33:09 +0100 (Fri, 05 Feb 2010) | 2 lines
Discovered that List's deprecated removeDuplicates didn't survive the
renaming of unique to distinct. No review. ........ r20806 | ilyas |
2010-02-05 21:06:07 +0100 (Fri, 05 Feb 2010) | 1 line
scalap output bug fixed
........
r20807 | ilyas | 2010-02-05 21:54:40 +0100 (Fri, 05 Feb 2010) | 1 line
testdata changed
........
r20812 | extempore | 2010-02-06 05:15:08 +0100 (Sat, 06 Feb 2010) | 4 lines
A more MSIL-aware attempt at isolating the platform dependent pieces
of Global and ClassPath so we don't introduce unwanted dependencies.
Introduces a small interface backend.Platform which encapsulates that
data. Review by rytz, odersky. ........ r20816 | extempore | 2010-02-07
01:13:55 +0100 (Sun, 07 Feb 2010) | 2 lines
Some code duplication removal as I inch us toward consistent classpath
handling. No review. ........ r20818 | milessabin | 2010-02-07 23:14:40
+0100 (Sun, 07 Feb 2010) | 1 line
IntelliJ project metadata updated for new location. Thanks to Tony
Coates for the patch. ........ r20826 | rytz | 2010-02-08 16:37:34 +0100
(Mon, 08 Feb 2010) | 1 line
fix msil build (nested classes in particular). no review. ........
r20828 | phaller | 2010-02-08 18:15:22 +0100 (Mon, 08 Feb 2010) | 1 line
Re-added deprecated member to scala.actors.Future. No review
necessary. ........ r20829 | dubochet | 2010-02-08 22:28:30 +0100 (Mon,
08 Feb 2010) | 5 lines
[scaladoc] Many improvements in the UI for Scaladoc's entity index
(left-pane):
- It is possible to "focus" on a package to restrict searches on it.
- Filtering in left pane no longer blocks the UI.
- The filter tool for packages is easily recognizable for what it is, not just an empty, mysterious space.
Review by community.
........
r20830 | dubochet | 2010-02-08 22:28:47 +0100 (Mon, 08 Feb 2010) | 1 line
[scaladoc] Fully qualified names are displayed in tooltips instead
of using in-place growth. All inherited members can be filtered in a
single operation. Contributed by Pedro Furlanetto, checked by dubochet,
no review. ........ r20831 | extempore | 2010-02-08 23:28:17 +0100 (Mon,
08 Feb 2010) | 20 lines
Some work on classpaths. This implements the specification at
https://lampsvn.epfl.ch/trac/scala/wiki/Classpath modulo some
minor details which remain to be investigated. It is not entirely
integrated, and should not involve any behavioral changes. The patch
also contains a number of small improvements targetting widely
duplicated code.
PathResolver offers a main method. If run with no arguments it will
output a pile of information about classpath relevant environment vars
and properties. If given arguments, it will output the classpath info
that any scala runner script would use if given the same args. There
is a wrapper in the tools directory. Example:
tools/pathResolver -extdirs /foo -sourcepath /bar | egrep
"sourcePath|scalaExtDirs"
scalaExtDirs = /foo
sourcePath = /bar
There is also a (probably temporary) command line option
-Ylog-classpath which will print out the settings.classpath value
anytime it changes. Review by community. ........ r20832 | extempore |
2010-02-09 00:09:49 +0100 (Tue, 09 Feb 2010) | 8 lines
Until now directories on the classpath were not considered for repl
completion because of the risk of accidentally traversing large chunks
of the filesystem (e.g. "." in the path, run from /). Some low hanging
fruit was available - at least SCALA_HOME can be considered safe, and
then we get the scala classes.
The main impact of this is that completion now works for the built-in
classes when you run build/quick/bin/scala. Review by community.
........ r20834 | milessabin | 2010-02-09 10:58:24 +0100 (Tue, 09 Feb
2010) | 1 line
Export missing package.
........
r20835 | milessabin | 2010-02-09 11:15:16 +0100 (Tue, 09 Feb 2010) | 1 line
Compiler part of fix for #2767: provide hooks to allow the
presentation compiler to add sources to the run to resolve top-level
symbols which cannot be found via the Java naming convention. Review by
odersky. ........ r20840 | prokopec | 2010-02-09 16:31:11 +0100 (Tue, 09
Feb 2010) | 1 line
`replaceSomeIn` method added. Removed `replaceAllIN` taking a String
to String. ........ r20842 | extempore | 2010-02-09 19:37:44 +0100 (Tue,
09 Feb 2010) | 1 line
No double-processing format strings. Closes #3040. No review. ........
r20843 | rompf | 2010-02-09 20:08:07 +0100 (Tue, 09 Feb 2010) | 1 line
some small byval mode changes. review by odersky. ........ r20844 |
dragos | 2010-02-09 20:21:34 +0100 (Tue, 09 Feb 2010) | 1 line
Fixed partially specialized classes. Closes #2880. No review. ........
r20849 | rytz | 2010-02-10 10:03:13 +0100 (Wed, 10 Feb 2010) | 1 line
close #3003. no review, already done by dragos.
........
r20850 | prokopec | 2010-02-10 12:12:55 +0100 (Wed, 10 Feb 2010) | 1 line
fixes #3046
........
r20851 | rompf | 2010-02-10 15:21:57 +0100 (Wed, 10 Feb 2010) | 1 line
modified typing of while loops to allow other types than Unit (e.g.
Unit @cps). review by odersky. ........ r20852 | rytz | 2010-02-10
15:48:58 +0100 (Wed, 10 Feb 2010) | 1 line
close #2984. review by community.
........
r20854 | plocinic | 2010-02-10 17:51:13 +0100 (Wed, 10 Feb 2010) | 1 line
Closes #2651
........
r20855 | phaller | 2010-02-10 18:11:11 +0100 (Wed, 10 Feb 2010) | 1 line
partest no longer treats remaining .log files as tests. No review
necessary. ........ r20856 | extempore | 2010-02-10 20:51:38 +0100 (Wed,
10 Feb 2010) | 5 lines
More work on classpaths. This commit should restore the ability to
have command line options following source files, at the price of
temporarily breaking tools/pathResolver. Working my way through all the
usages of classpath in trunk zeroing in on fully consistent handling.
Review by community. ........ r20857 | extempore | 2010-02-11 00:20:02
+0100 (Thu, 11 Feb 2010) | 1 line
Disabled failing test. Review by plocinic.
........
r20858 | plocinic | 2010-02-11 00:29:54 +0100 (Thu, 11 Feb 2010) | 1 line
Fixes #3045. No review.
........
r20862 | plocinic | 2010-02-11 11:14:59 +0100 (Thu, 11 Feb 2010) | 1 line
Removed leftovers of r20857, added test for #3045 ........ r20863 |
extempore | 2010-02-11 14:47:13 +0100 (Thu, 11 Feb 2010) | 2 lines
Trying to get when "." is added to the classpath under control.
Band-aid for an obscure bit of fallout closes #3049. No review. ........
r20864 | dubochet | 2010-02-11 14:55:34 +0100 (Thu, 11 Feb 2010) | 1
line
[scaladoc] Fixed popup content lookup so that it works on all
browsers. Speed-up in entity index search (according to jQuery manual,
observed no notable difference). Some small aesthetic cleanups in the
way index initialization and filtering behaves. No review. ........
r20866 | extempore | 2010-02-11 16:10:45 +0100 (Thu, 11 Feb 2010) | 6
lines
More work on classpaths. This commit also unbreaks fsc, for which we
must have no test cases at all. In the short term there will probably be
a few more minor disruptions since with classpaths constructed a half
dozen different ways, achieving consistency requires flushing out the
undocumented accidents upon which any given island might depend. Review
by community. ........ r20867 | rompf | 2010-02-11 17:58:12 +0100 (Thu,
11 Feb 2010) | 1 line
added annotation checker hook for Types.isWithinBounds. needed to
allow functions of type T => A @cps[B,C] even though A @cps[B,C] is
not a subtype of Any. review by odersky. ........ r20869 | extempore |
2010-02-12 00:37:15 +0100 (Fri, 12 Feb 2010) | 8 lines
The non-intrusive bits of my hopefully pending "use the static type
of the scrutinee to rule out some type/extractor patterns" patch.
Includes a cleanup of the (still inadequate) type-parameter-ignoring
match test which had been interfering with martin's digestion.
Also: implicit search is disabled when typing a pattern, because the
matcher never invokes implicits to satisfy a pattern. At worst maybe
we'll get a performance bump. No review. ........ r20872 | dubochet |
2010-02-12 16:53:39 +0100 (Fri, 12 Feb 2010) | 1 line
[scaladoc] Fixes for IE 8 compatibility. Partially contributed by
Pedro Furlanetto, no review. ........ r20873 | prokopec | 2010-02-12
19:20:26 +0100 (Fri, 12 Feb 2010) | 1 line
Fixes #3046 once more. No review is necessary.
........
r20874 | dubochet | 2010-02-12 19:43:49 +0100 (Fri, 12 Feb 2010) | 1 line
[scaladoc] Added "display packages only" filter to entity index. No
review. ........ r20878 | extempore | 2010-02-14 01:08:01 +0100 (Sun, 14
Feb 2010) | 7 lines
Some change to classpath handling in r20866 has left quick in a
condition where it won't load Array. After a fair bit of beating my
head against the wall as to why, I determined that everything works
if I simply don't throw the exception it used to throw. In the short
term I am committing this so quick works, and I will continue the
investigation. Review by dragos (2 line patch to minimize reviewer
burden.) ........ r20879 | extempore | 2010-02-14 02:00:37 +0100 (Sun,
14 Feb 2010) | 2 lines
Reducing the amount of low-level classpath manipulation going on
around town. No review. ........ r20880 | extempore | 2010-02-14
07:52:11 +0100 (Sun, 14 Feb 2010) | 2 lines
Added some error logic so if #2956 strikes again we'll have a better
idea why. No review. ........ r20881 | extempore | 2010-02-14 09:47:18
+0100 (Sun, 14 Feb 2010) | 4 lines
More classpath work, and cleanups in the vicinities of everything
manipulating classpaths. Review by anyone willing to slog through the
approximately dozen different ways the classpath can be influenced.
........ r20884 | extempore | 2010-02-15 07:32:50 +0100 (Mon, 15 Feb
2010) | 3 lines
Restored the disabled exception in classfileparser. Strange quick
behavior was being caused by multiple occurrences of some classpath
elements. No review. ........ r20885 | dragos | 2010-02-15 11:12:00
+0100 (Mon, 15 Feb 2010) | 1 line
Merge branch 'fix-specialized'
........
r20886 | extempore | 2010-02-15 17:41:17 +0100 (Mon, 15 Feb 2010) | 6 lines
Disabled JavaInteraction test. This test has been costing me a lot of
time because it fails if you can't connect to the screen of the test
machine. And then if any test fails, the stability test doesn't run. We
badly a separate testing area for tests which are prone to failure for
reasons which are unrelated to the quality ostensibly being tested. No
review. ........ r20887 | extempore | 2010-02-15 17:55:21 +0100 (Mon, 15
Feb 2010) | 1 line
Fix for the out-of-date showpickled. No review.
........
r20888 | extempore | 2010-02-15 21:00:36 +0100 (Mon, 15 Feb 2010) | 18 lines
Some new tools for the tools directory. Everything in this commit
amounts to a yak shaving expedition to enable this, which now works:
tools/diffPickled scala.Either
and since stability is presently broken you will see the following.
(When it's not broken you will see nothing.)
541,544c541,544
< 538,4090: EXTref 3: 539(Left) 2
< 539,4095: TYPEname 4: Left
< 540,4101: EXTref 3: 541(Right) 2
< 541,4106: TYPEname 5: Right
---
> 538,4090: EXTref 3: 539(Right) 2
> 539,4095: TYPEname 5: Right
> 540,4102: EXTref 3: 541(Left) 2
> 541,4107: TYPEname 4: Left
........
r20889 | extempore | 2010-02-15 22:44:28 +0100 (Mon, 15 Feb 2010) | 2 lines
Rewrote my own submitted code of a year ago from trac and added
scalawhich to the tools dir. Closes #657. ........ r20894 | extempore |
2010-02-16 17:31:29 +0100 (Tue, 16 Feb 2010) | 1 line
Some minor bugfixing/refining to completion. No review. ........
r20895 | extempore | 2010-02-16 20:57:44 +0100 (Tue, 16 Feb 2010) | 2
lines
Some prestidigitation improving the repl startup time. The prompt
is quicker than the eye! No review. ........ r20896 | extempore |
2010-02-16 20:59:22 +0100 (Tue, 16 Feb 2010) | 1 line
Last minute change broke the last commit. Fixing. No review. ........
r20897 | extempore | 2010-02-16 22:03:43 +0100 (Tue, 16 Feb 2010) | 1
line
Trying again to unbreak the repl patch. No review. ........ r20898 |
extempore | 2010-02-16 22:22:10 +0100 (Tue, 16 Feb 2010) | 2 lines
Unix scripts pass -D options to the underlying JVM invocation. Closes
#1222. Review by community. ........ r20899 | extempore | 2010-02-16
22:41:01 +0100 (Tue, 16 Feb 2010) | 2 lines
Made partest stop crashing on test directories without a lib
directory. No review. ........ r20900 | extempore | 2010-02-16 23:28:27
+0100 (Tue, 16 Feb 2010) | 3 lines
Altered Symbol.isLess to sort on initName before id. No longer will
slightly different classpaths break the stability test. Review by
odersky. ........ r20901 | extempore | 2010-02-17 00:48:32 +0100 (Wed,
17 Feb 2010) | 5 lines
Took a less ambitious approach to restoring stability. Leave
isLess as it was and have the pickler sort without using isLess.
Interestingly this approach still leaves a class failing the stability
test (scala/actors/remote/Apply0.class) so a little more will be needed.
Review by odersky. ........ r20905 | milessabin | 2010-02-17 01:47:55
+0100 (Wed, 17 Feb 2010) | 1 line
Fix and test case for #3031. Review by odersky.
........
r20906 | plocinic | 2010-02-17 12:34:35 +0100 (Wed, 17 Feb 2010) | 1 line
Checking the symbols of parameters in overloaded methods didn't seem
to work in all cases. Apparently the enclosing class of the owner of
the parameter was changing during the compilations from trait to the
implementation class. This was causing annoying excessive compilation
for Types.scala. ........ r20907 | prokopec | 2010-02-17 13:22:37 +0100
(Wed, 17 Feb 2010) | 1 line
Array copy method fixed, Fixes #3065. Review by community. ........
r20908 | prokopec | 2010-02-17 13:23:13 +0100 (Wed, 17 Feb 2010) | 1
line
Test file for last commit.
........
r20909 | milessabin | 2010-02-17 18:15:51 +0100 (Wed, 17 Feb 2010) | 1 line
Fix for silly mistake in [20835]. No review.
........
r20911 | extempore | 2010-02-17 20:01:22 +0100 (Wed, 17 Feb 2010) | 1 line
Added a copy() method to Settings. No review.
........
r20912 | extempore | 2010-02-17 22:26:02 +0100 (Wed, 17 Feb 2010) | 5 lines
A variety of changes to partest made in a quest to get it to
reveal the classpaths it is using. No longer will partest actively
sabotage your efforts to pass -Dpartest.debug=true by inserting
"-Dpartest.debug=" after yours! And etc. Review by haller (if so
inclined.) ........ r20913 | extempore | 2010-02-17 22:37:08 +0100 (Wed,
17 Feb 2010) | 2 lines
...and managed to miss the key file in getting past partest. No
review. ........ r20917 | extempore | 2010-02-18 06:39:18 +0100 (Thu, 18
Feb 2010) | 4 lines
Fix for recent stability issue with Apply0. Look, shuffling classpaths
flushes out bugs, we should do this all the time. Review by odersky even
though he authored it, because reliving one's own patches is the key
to a long and healthy life. ........ r20918 | extempore | 2010-02-18
06:40:27 +0100 (Thu, 18 Feb 2010) | 10 lines
Tighter pattern matching hits the street. If the scrutinee is final
and does not conform to the pattern, it will no longer compile. See
all the exciting things you can no longer do:
"bob".reverse match { case Seq('b', 'o', 'b') => true } // denied!
"bob".toArray match { case Seq('b', 'o', 'b') => true } // rejected!
final class Dunk
def f3(x: Dunk) = x match { case Seq('b', 'o', 'b') => true } // uh-uh!
And so forth. Review by odersky.
........
r20920 | extempore | 2010-02-18 19:49:21 +0100 (Thu, 18 Feb 2010) | 2 lines
The first reasonably satisfying classpath commit. We are 90% there
with this one. Documentation to come. Review by community. ........
r20921 | extempore | 2010-02-18 20:00:46 +0100 (Thu, 18 Feb 2010) | 1
line
Made NumericRange invariant again, plus test case. Closes #2518.
........ r20922 | milessabin | 2010-02-18 22:51:39 +0100 (Thu, 18 Feb
2010) | 1 line
Patch from Mirko Stocker correcting start postions of import AST nodes
for refactoring and other tools. Review by community. ........ r20928 |
milessabin | 2010-02-19 16:31:36 +0100 (Fri, 19 Feb 2010) | 1 line
Fixed #3043 and #3043; fixed a regression with hover/hyperlinks on
import statements; don't attempt to parse out top-level types from
non-Scala sources. Review by community. ........ r20929 | extempore |
2010-02-19 22:43:35 +0100 (Fri, 19 Feb 2010) | 1 line
Some script fixes tied up with classpaths. No review. ........ r20932
| extempore | 2010-02-20 05:47:43 +0100 (Sat, 20 Feb 2010) | 2 lines
Temporarily reverting r20928 as it is leading to ant dist crashing.
Review by milessabin. ........ r20933 | extempore | 2010-02-20 06:38:34
+0100 (Sat, 20 Feb 2010) | 3 lines
Some cleanups on the scalacfork ant task since I'm clearly going to
have to go through everything which touches classpaths in any way shape
or form. No review. ........ r20934 | extempore | 2010-02-20 07:48:29
+0100 (Sat, 20 Feb 2010) | 3 lines
Altered the ant task to generate a -Dscala.home= property, which now
acts as signal to scalac to ignore the java classpath and use only the
scala classpath. No review. ........ r20935 | extempore | 2010-02-20
21:00:46 +0100 (Sat, 20 Feb 2010) | 2 lines
Band-aid for #3081, issue should receive more comprehensive treatment.
Review by imaier. ........ r20936 | milessabin | 2010-02-20 21:32:40
+0100 (Sat, 20 Feb 2010) | 1 line
Another attempt at retaining ill-typed trees for the IDE, this time
without breaking scaladoc. Review by extempore. ........ r20937 |
extempore | 2010-02-20 22:16:49 +0100 (Sat, 20 Feb 2010) | 3 lines
Having some challenges confirming the validity of the bootstrap
process given starr's slightly dated classpath code, so this is a
new starr based on r20934. No review. ........ r20938 | extempore |
2010-02-20 23:50:20 +0100 (Sat, 20 Feb 2010) | 4 lines
Lowering the noise level in the classpath debugging output. Try ant
-Dscalac.args="-Ylog-classpath" if you would like the rare joy of having
a fair idea what is being used to compile what. No review. ........
r20941 | extempore | 2010-02-21 06:01:55 +0100 (Sun, 21 Feb 2010) | 1
line
Some repl cleanups and debugging conveniences. No review. ........
r20942 | extempore | 2010-02-21 22:56:56 +0100 (Sun, 21 Feb 2010) | 2
lines
Some more code for seeing what's going on in in scalac's mind with
respect to who to load when and from where. No review. ........ r20944 |
extempore | 2010-02-22 01:15:32 +0100 (Mon, 22 Feb 2010) | 2 lines
More laboring on Settings, ClassPaths, Ant Tasks, Partest, and similar
epicenters of thrilldom. No review. ........ r20945 | extempore |
2010-02-22 01:16:03 +0100 (Mon, 22 Feb 2010) | 1 line
Some deprecation patrol and minor cleanups. No review. ........ r20949
| dragos | 2010-02-22 14:11:49 +0100 (Mon, 22 Feb 2010) | 1 line
Specialized types are not substituted inside type arguments. Closes
#3085, no review. ........ r20950 | phaller | 2010-02-22 18:43:40 +0100
(Mon, 22 Feb 2010) | 4 lines
- Added fair mode to ForkJoinScheduler, which submits tasks to global queue with a 2% chance
- Reactor uses ForkJoinScheduler by default
- Moved ActorGC to scheduler package
- Various clean-ups
........
r20951 | extempore | 2010-02-22 22:47:41 +0100 (Mon, 22 Feb 2010) | 3 lines
A simple command line parser to consolidate a bunch of different
implementations floating around trunk. And rolled it out in partest's
ConsoleRunner. Review by community. ........ r20952 | milessabin |
2010-02-23 00:39:10 +0100 (Tue, 23 Feb 2010) | 1 line
Yet another attempt at retaining ill-typed trees for the IDE ...
this time docs.comp should be unbroken. ........ r20953 | extempore |
2010-02-23 01:27:39 +0100 (Tue, 23 Feb 2010) | 5 lines
Some much needed housecleaning regarding system properties. If you
can possibly resist the temptation, it'd be great if people could try
to go through the properties classes to get and set them, and also to
set property values somewhere fixed rather than using strings directly.
Review by community. ........ r20954 | extempore | 2010-02-23 04:49:01
+0100 (Tue, 23 Feb 2010) | 2 lines
More fun with ClassPaths. Could that be the home stretch I see? Review
by community. ........ r20955 | extempore | 2010-02-23 05:42:53 +0100
(Tue, 23 Feb 2010) | 1 line
Oops, I broke jline in r20953. Fixed. No review. ........ r20956 |
extempore | 2010-02-23 07:57:53 +0100 (Tue, 23 Feb 2010) | 2 lines
Abstracting out a few more platform specific elements now that we have
a facility for doing so. Review by rytz. ........ r20957 | extempore |
2010-02-23 09:21:00 +0100 (Tue, 23 Feb 2010) | 1 line
Introducing partest to the idea of code reuse. No review. ........
r20958 | extempore | 2010-02-23 09:32:53 +0100 (Tue, 23 Feb 2010) | 11
lines
Added productElementName to Product. Now you can access all the case
class field names your heart desires. Review by odersky.
scala> case class Foo[T](kilroy: String, burma: List[T], shave:
Seq[Int]) defined class Foo
scala> Foo("was here", List('myanmar), Seq(25, 25))
res0: Foo[Symbol] = Foo(was here,List('myanmar),List(25, 25))
scala> 0 to 2 map (res0 productElementName _)
res1: IndexedSeq[String] = IndexedSeq(kilroy, burma, shave)
........
r20959 | imaier | 2010-02-23 12:18:34 +0100 (Tue, 23 Feb 2010) | 1 line
Added TextComponent.paste, made some accidentially public publisher
methods protected. ........ r20960 | imaier | 2010-02-23 12:33:50 +0100
(Tue, 23 Feb 2010) | 1 line
Fix for #3084
........
r20961 | dubochet | 2010-02-23 15:19:20 +0100 (Tue, 23 Feb 2010) | 1 line
[scaladoc] Updated jQuery to version 1.4.2. No review. ........ r20962
| phaller | 2010-02-23 18:34:50 +0100 (Tue, 23 Feb 2010) | 1 line
Control-flow combinators do not require thread-local variable in
Reactor. Review by plocinic. ........ r20963 | extempore | 2010-02-23
19:15:37 +0100 (Tue, 23 Feb 2010) | 3 lines
After the compiler refactor, we ended up with identical copies of
PickleBuffer and PickleFormat in the library and compiler. Deleted the
compiler versions and updated references. No review. ........ r20964 |
extempore | 2010-02-23 19:15:59 +0100 (Tue, 23 Feb 2010) | 1 line
Removed now redundant function splitParams. No review. ........ r20965
| prokopec | 2010-02-23 19:57:52 +0100 (Tue, 23 Feb 2010) | 1 line
Fixes #3018. Review by extempore.
........
r20966 | phaller | 2010-02-23 20:36:38 +0100 (Tue, 23 Feb 2010) | 1 line
Fixed tests to unbreak build. No review.
........
r20967 | extempore | 2010-02-23 22:16:51 +0100 (Tue, 23 Feb 2010) | 4 lines
The initial results of running a basic cut and paste detector over
trunk and trying to undo some of it. I can live with history but if I
see Cutty McPastington in new commits I will get all finger waggly.
Don't make me cross that ocean. No review. ........ r20968 | milessabin
| 2010-02-23 22:59:14 +0100 (Tue, 23 Feb 2010) | 1 line
Improved fix for #2767. Review by community.
........
r20969 | extempore | 2010-02-23 23:15:38 +0100 (Tue, 23 Feb 2010) | 1 line
Fixed a little command line partest bug I introduced. No review.
........ r20970 | milessabin | 2010-02-23 23:34:17 +0100 (Tue, 23 Feb
2010) | 1 line
Removed stray debugging code.
........
r20972 | extempore | 2010-02-24 02:59:44 +0100 (Wed, 24 Feb 2010) | 1 line
Another update for ShowPickled. No review.
........
r20973 | extempore | 2010-02-24 03:27:03 +0100 (Wed, 24 Feb 2010) | 6 lines
Updated scalacheck jar to current trunk. Tracked down why it's
not being used. Updated partest with a --scalacheck option. Added
scalacheck tests to the ant build target. Still struggling with
ant/partest/classpaths so it's not on by default yet, but at least
./partest --scalacheck works. We... will... use... scalacheck. And we
will like it! No review. ........ r20974 | phaller | 2010-02-24 13:18:45
+0100 (Wed, 24 Feb 2010) | 1 line
Fixed problem with daemon actor termination. No review. ........
r20976 | dubochet | 2010-02-24 16:51:10 +0100 (Wed, 24 Feb 2010) | 1
line
[scaladoc] Preliminary support for links and lists in wiki syntax,
as well as printing of lists. Fix to display of "inherits" classes.
Contributed by Pedro Furlanetto, no review. Member names in signature
are more contrasted and are aligned. ........ r20977 | prokopec |
2010-02-24 17:55:31 +0100 (Wed, 24 Feb 2010) | 1 line
Fixes #3088. No review.
........
r20978 | extempore | 2010-02-25 00:17:30 +0100 (Thu, 25 Feb 2010) | 22 lines
Bash completion! The file is automatically created as part of the
build process and placed in $pack/etc.
% scala -Xprint
-Xprint-icode -Xprint-pos -Xprint-types -Xprint:
% scala -Xprint:
all flatten mixin tailcalls
cleanup icode namer terminal
closelim inliner packageobjects typer
constructors jvm parser uncurry
dce lambdalift pickler
erasure lazyvals refchecks
explicitouter liftcode superaccessors
% scala -g:
line none notailcalls source vars
% scala -Ystruct-dispatch:
invoke-dynamic mono-cache no-cache poly-cache
Review by community.
........
r20979 | extempore | 2010-02-25 01:14:04 +0100 (Thu, 25 Feb 2010) | 4 lines
The build file wasn't quite all the way on the bash completion commit.
Now it should work, and also be copied into the distribution. Review by
anyone who may be cruel enough to oppose including completion in the
distribution. ........ r20980 | extempore | 2010-02-25 02:35:46 +0100
(Thu, 25 Feb 2010) | 8 lines
Created -Yfatal-warnings, as otherwise I can't see how to make partest
fail on the presence of an unchecked warning. It'll come in handy
anyway. Now we have a real tough guy's command line for those who want
it:
% scalac -unchecked -deprecation -Yfatal-warnings `find . -name
'*.scala'`
Not for the timid. Review by community.
........
r20981 | extempore | 2010-02-25 03:36:06 +0100 (Thu, 25 Feb 2010) | 1 line
Fix for a king-sized last-minute thinko. No review. ........ r20982 |
extempore | 2010-02-25 03:53:35 +0100 (Thu, 25 Feb 2010) | 3 lines
Some debugging code for partest. If --debug is given it collects
timings on all the individual tests and prints it sorted by glacialness.
Review by community. ........ r20983 | extempore | 2010-02-25 03:54:04
+0100 (Thu, 25 Feb 2010) | 4 lines
Tweaking the sealed logic in light of #3097. Closes #3097. Reorganizes
children a little so they always come back sorted the same way the
pickler does. Taking advantage of -Yfatal-warnings in the test case.
Review by community. ........ r20984 | extempore | 2010-02-25 04:15:34
+0100 (Thu, 25 Feb 2010) | 1 line
Trying to fix svn props on scalacheck jar. No review. ........ r20985
| extempore | 2010-02-25 07:08:27 +0100 (Thu, 25 Feb 2010) | 5 lines
It turns out some of the weirdness lately is because changes to
classpath handling have a way of not taking effect until they're
installed via starr, and presently we have a starr with different logic
than trunk. No choice but to roll up one more starr based on r20984. No
review. ........ r20986 | prokopec | 2010-02-25 16:16:24 +0100 (Thu, 25
Feb 2010) | 1 line
Fixes #3088. No review.
........
r20987 | dragos | 2010-02-25 16:53:13 +0100 (Thu, 25 Feb 2010) | 1 line
Made the squeezer worthy of its name: a block with an empty list
of stats and another block as the result expression is rewritten to
the inner block (recursively). This makes the output from the pattern
matcher nicer, eliminating loads of empty nested blocks. Review by
extempore. ........ r20988 | phaller | 2010-02-25 17:20:25 +0100 (Thu,
25 Feb 2010) | 1 line
Physically moved ActorGC to scheduler directory.
........
r20989 | phaller | 2010-02-25 17:26:05 +0100 (Thu, 25 Feb 2010) | 1 line
Made doc comment consistent. No review.
........
r20990 | extempore | 2010-02-25 19:24:58 +0100 (Thu, 25 Feb 2010) | 2 lines
Working on making the bootstrap process transparent and consistent.
And removed a bunch of what is now cruft in partest. No review. ........
r20991 | extempore | 2010-02-25 20:49:25 +0100 (Thu, 25 Feb 2010) | 3
lines
Looking at iulian's patch to the squeezer sent me off looking at
equalsStructure, which clearly was written in a bygone era. Rewritten
with modern tools. No review. ........ r20992 | extempore | 2010-02-25
20:50:28 +0100 (Thu, 25 Feb 2010) | 2 lines
More partest cleanups, and putting back a couple lines in build.xml
which were left a little too commented out. No review. ........ r20993 |
extempore | 2010-02-25 21:50:43 +0100 (Thu, 25 Feb 2010) | 2 lines
What appears to be a workaround for #3082, which I am hitting
literally 20 times a day. Will detail in ticket. Review by odersky.
........ r20994 | extempore | 2010-02-25 22:20:59 +0100 (Thu, 25 Feb
2010) | 2 lines
More return type annotation to work around my other frequent guest in
the world of #3082-connected pickler bugs. No review. ........ r20995 |
extempore | 2010-02-25 23:09:37 +0100 (Thu, 25 Feb 2010) | 2 lines
Added a --bare option to ShowPickled so I can diff signatures without
all the explicit indices blowing any points of similarity. No review.
........ r20996 | moors | 2010-02-26 10:16:22 +0100 (Fri, 26 Feb 2010) |
5 lines
closes #2797 -- no review (already done in ticket by Martin)
1) isHigherKindedType is now false for singletontype 2) toInstance
recurses when pre is a typevar: the problem is that pre.widen.typeSymbol
isNonBottomSubClass symclazz is true while pre.baseType(symclazz) is
NoType ........ r20997 | moors | 2010-02-26 10:42:50 +0100 (Fri, 26 Feb
2010) | 4 lines
closes #2956
the problem was that corresponds on Seq's does not check length of
sequences before testing the predicate, whereas in some cases that
predicate relied on this invariant (when it was doing substitution)
........ r20998 | moors | 2010-02-26 11:00:49 +0100 (Fri, 26 Feb 2010) |
1 line
see #2634: updated docs to indicate zipped is strict ........ r20999 |
moors | 2010-02-26 11:50:32 +0100 (Fri, 26 Feb 2010) | 2 lines
closes #2421 -- now also deals with chained implicits
no review
........
r21000 | moors | 2010-02-26 12:04:02 +0100 (Fri, 26 Feb 2010) | 2 lines
closes #2741 closes #3079 no review
worksforme
........
r21001 | rytz | 2010-02-26 13:49:02 +0100 (Fri, 26 Feb 2010) | 1 line
close #3071. look at owner.info only later in type completer, not
during namer. review by odersky ........ r21003 | extempore | 2010-02-26
18:03:22 +0100 (Fri, 26 Feb 2010) | 3 lines
Undid my awful code which had broken the thread scheduler selection.
Further unbroke it beyond that unbreaking hopefully to the point where
java 1.6 on OSX is recognized as such. Review by haller. ........ r21004
| odersky | 2010-02-26 19:31:35 +0100 (Fri, 26 Feb 2010) | 1 line
closes #3082, review by rytz
........
r21005 | extempore | 2010-02-26 23:24:46 +0100 (Fri, 26 Feb 2010) | 14 lines
Quite a lot more work on XML equality than I can properly justify
spending time on, but you know how it is once you get started on
something. This commit will likely break some code out there in the
world but this is impossible to avoid if we are to achieve sane
equality in trunk.
For anyone who was relying upon the 2.7 equality behavior for
scala.xml.* classes, using "xml_==" instead of "==" for comparisons
will restore the old behavior. The standard == on xml elements now
attempts to behave in such a way that symmetry and hashCode contracts
will be preserved. It's probably not 100% there yet, but I can tell
you this: it is closer today than it was yesterday.
Review by community.
........
r21006 | extempore | 2010-02-27 04:46:48 +0100 (Sat, 27 Feb 2010) | 17 lines
Removed the partest restriction that individual files must be in the
same set. Haven't you always wanted to do this? Now you can. Review by
phaller.
% ./partest `ack --type=scala -l HashSet | head -6`
Testing individual files
testing: [...]/files/jvm/serialization.scala [ OK ]
testing: [...]/files/jvm/t1600.scala [ OK ]
Testing individual files
testing: [...]/files/pos/collections.scala [ OK ]
testing: [...]/files/pos/t2183.scala [ OK ]
Testing individual files
testing: [...]/files/run/bug1074.scala [ OK ]
testing: [...]/files/run/bug2512.scala [ OK ]
........
r21007 | extempore | 2010-02-27 06:47:03 +0100 (Sat, 27 Feb 2010) | 1 line
Some library reorganization I discussed with martin. No review.
........ r21008 | extempore | 2010-02-27 21:10:48 +0100 (Sat, 27 Feb
2010) | 2 lines
Special cased an error message for the common situation of calling
AnyRef methods on Any or AnyVal. Review by odersky. ........ r21009 |
extempore | 2010-02-28 00:49:51 +0100 (Sun, 28 Feb 2010) | 2 lines
Expanded the check from #1392 to enclose #3123 as well so that "case
Int => " doesn't crash. Closes #3123. Review by odersky. ........ r21010
| extempore | 2010-02-28 01:30:21 +0100 (Sun, 28 Feb 2010) | 13 lines
While working on Any.## I ran across some interesting tests being made
in TreeBuilder:
val buf = new ListBuffer[(Name, Tree, Position)]
[...]
if (buf.iterator forall (name !=)) ...
This is always true because a Name will never equal a Tuple3. Oh
universal equality, will you never tire of toying with us? Given that
this bug has existed since r12886 one might reasonably question the
necessity of the conditionals falling prey to this, but leaving that
for another day, it should at least check what it's trying to check. No
review. ........ r21011 | extempore | 2010-02-28 15:35:50 +0100 (Sun, 28
Feb 2010) | 10 lines
Added ## method to Any as our scala hashCode method which provides
consistent answers for primitive types. And I'm sure we're all tired
of new starrs, but it's hard to add a method to Any without one. This
patch only brings ## into existence, but nothing calls it yet.
// some true assertions
scala> assert(5.5f.## == 5.5f.hashCode)
scala> assert(5.0f.## != 5.0f.hashCode && 5.0f.## == 5L.##)
No review. (Already reviewed by odersky.)
........
r21012 | extempore | 2010-02-28 17:52:03 +0100 (Sun, 28 Feb 2010) | 2 lines
Modification to r21009 to preserve that classic invariant, (x || !x)
&& !(x && !x). No review. ........ r21013 | dragos | 2010-02-28 22:09:06
+0100 (Sun, 28 Feb 2010) | 2 lines
Fixed specialized pattern matches. Incompatible cases are removed from
specialized implementations. ........ r21014 | extempore | 2010-03-01
06:59:11 +0100 (Mon, 01 Mar 2010) | 6 lines
Enabled scalacheck tests. Renamed the super confusing and what must
be legacy scalatest.* properties to partest.*, boldly assuming that the
fact that partest is pretty much unusable outside of scalac means there
are no users outside of scalac who might be disrupted by eliminating
old property names. Review by community. ........ r21015 | ilyas |
2010-03-01 11:25:59 +0100 (Mon, 01 Mar 2010) | 1 line
Minor printer fix for singleton types
........
r21016 | odersky | 2010-03-01 11:59:46 +0100 (Mon, 01 Mar 2010) | 1 line
Added one previously overlooked case for computing the right tparams
of glbs of polytypes. This is a postscript to the fix of #3082. ........
r21017 | odersky | 2010-03-01 12:00:15 +0100 (Mon, 01 Mar 2010) | 1 line
closed #3101. Review by community.
........
r21018 | odersky | 2010-03-01 12:02:12 +0100 (Mon, 01 Mar 2010) | 1 line
Following a suggestion of jrudolph, made filterKeys and mapValues
transform abstract maps, and duplicated functionality for immutable
maps. Moved transform and filterNot from immutable to general maps.
Review by phaller. ........ r21019 | odersky | 2010-03-01 12:11:25 +0100
(Mon, 01 Mar 2010) | 1 line
Closes #3076. Review by community.
........
r21020 | ilyas | 2010-03-01 15:17:44 +0100 (Mon, 01 Mar 2010) | 1 line
#3060 fixed
........
r21021 | odersky | 2010-03-01 15:35:58 +0100 (Mon, 01 Mar 2010) | 1 line
Added missing file that broke the build.
........
r21022 | ilyas | 2010-03-01 15:51:38 +0100 (Mon, 01 Mar 2010) | 1 line
#2885 fixed
........
r21023 | ilyas | 2010-03-01 15:52:00 +0100 (Mon, 01 Mar 2010) | 1 line
typo in test fixed
........
r21024 | extempore | 2010-03-01 17:37:01 +0100 (Mon, 01 Mar 2010) | 3 lines
Undeprecated Function.tupled based on
the type inference issues documented at:
http://stackoverflow.com/questions/2354277/function-tupled-and-placehold
er-syntax We should revisit if anon function inference improves. Review
by community. ........ r21027 | ilyas | 2010-03-01 19:37:55 +0100 (Mon,
01 Mar 2010) | 1 line
scalap tests fixed
........
r21028 | ilyas | 2010-03-01 20:27:20 +0100 (Mon, 01 Mar 2010) | 1 line
trailing spaces in decompiled annotations are trimmed ........ r21029
| extempore | 2010-03-01 20:47:48 +0100 (Mon, 01 Mar 2010) | 6 lines
Whipped ShowPickled until it would print out private[scope] from the
signature, and infrastructure created along the way. Only now at this
late hour do I realize that this work would be a lot better aimed at
creating a fake Universe and then adapting UnPickler.Scan so you can
reuse the real logic. My advice to the next guy: do that instead. No
review. ........ r21031 | ilyas | 2010-03-02 02:02:55 +0100 (Tue, 02 Mar
2010) | 1 line
#3128 fixed
........
r21043 | extempore | 2010-03-02 20:44:01 +0100 (Tue, 02 Mar 2010) | 16 lines
Improved equality for Manifests. Implements symmetry via canEquals,
and has ClassManifests compare according to erasure but full manifests
also compare type arguments. Preserving symmetry means that some
things you might expect to be equal are not:
val m1 = scala.reflect.ClassManifest.fromClass(classOf[List[String]])
val m2 = manifest[List[String]]
(m1 == m2) // false
However you can always compare the erasures.
(m1.erasure == m2.erasure) // true
Review by dpp.
........
r21044 | extempore | 2010-03-02 21:28:45 +0100 (Tue, 02 Mar 2010) | 2 lines
Removed the symlinks between scalacheck jars to satisfy windows.
Tweaked partest to accomodate. No review. ........ r21045 | extempore |
2010-03-02 23:28:45 +0100 (Tue, 02 Mar 2010) | 6 lines
Added --grep command line option to partest. If you want to run every
test with the string "Manifest" in the source file, you may now do:
./partest --grep Manifest
No review.
........
r21053 | odersky | 2010-03-03 18:33:51 +0100 (Wed, 03 Mar 2010) | 1 line
Closes #3130. No review necessary.
........
r21054 | odersky | 2010-03-03 18:36:42 +0100 (Wed, 03 Mar 2010) | 1 line
Attempt to fix the typing-a-whileloop problem.
........
r21058 | extempore | 2010-03-04 06:22:57 +0100 (Thu, 04 Mar 2010) | 7 lines
A few yards short of the goal posts attempt at making our usage of
Throwable subclasses more consistent. This patch eliminates a lot of
ad hoc Exception/Error/etc. creation and various arbitrary choices are
rendered slightly less arbitrary. From now on let's try not to use the
word "Exception" or "Error" in the names of Throwable subclasses unless
they actually derive (and make sense to derive) from Exception or Error.
Review by community. ........ r21059 | extempore | 2010-03-04 06:23:21
+0100 (Thu, 04 Mar 2010) | 2 lines
Obeyed source comment to make some classes private, since the problem
described seems to be gone. No review. ........ r21060 | phaller |
2010-03-04 12:40:16 +0100 (Thu, 04 Mar 2010) | 1 line
Clean-ups in scheduler hierarchy. Restricted visibility of several
traits. Added tests exercising cleaned-up interface. ........ r21062 |
rompf | 2010-03-04 14:17:39 +0100 (Thu, 04 Mar 2010) | 1 line
fixed while loop performance. label def rhs re-check only done if first typing produces a different type than the initially assumed one (which is alsways Unit, so the recheck only happens if some AnnotationChecker says the type is not Unit but Unit @something).
........
r21063 | phaller | 2010-03-04 14:28:12 +0100 (Thu, 04 Mar 2010) | 1 line
Fixed actors.enableForkJoin property. Fixed build. Review by
extempore. ........ r21064 | odersky | 2010-03-04 15:06:18 +0100 (Thu,
04 Mar 2010) | 1 line
Closes #3118. review by extempore
........
r21065 | phaller | 2010-03-04 16:05:47 +0100 (Thu, 04 Mar 2010) | 1 line
Removed obsolete SimpleExecutorScheduler, ThreadPoolScheduler,
DefaultThreadPoolScheduler, and SchedulerService. Made ThreadPoolConfig
private. No review necessary. ........ r21066 | extempore | 2010-03-04
19:05:39 +0100 (Thu, 04 Mar 2010) | 4 lines
Added a comment to Symbols after one too many times forgetting what
I was in that file for while I traced which of the linked* functions
I wanted. Review by odersky (only because there's also a renaming
proposal in there for which I solicit your yea or nay.) ........ r21067
| extempore | 2010-03-04 21:18:41 +0100 (Thu, 04 Mar 2010) | 2 lines
Renamed the linkedFooOfBar methods in Symbol to be internally
consistent and in line with modern nomenclature. No review. ........
r21068 | extempore | 2010-03-04 22:06:08 +0100 (Thu, 04 Mar 2010) | 2
lines
Making sure the interpreter always uses the designated output stream
rather than unwittingly falling back on predef. No review. ........
r21071 | extempore | 2010-03-05 07:01:19 +0100 (Fri, 05 Mar 2010) | 8
lines
Added -Xmigration option and @migration annotation. At present it will
warn about the following changes from 2.7 to 2.8:
Stack iterator order reversed
mutable.Set.map returns a Set and thus discards duplicates
A case 'x @ Pattern' matches differently than 'Pattern'
Review by odersky.
........
r21073 | extempore | 2010-03-05 15:30:44 +0100 (Fri, 05 Mar 2010) | 2 lines
Removed quotes from quoted tokens in command line parser to soothe
Windows. Review by community. ........ r21074 | odersky | 2010-03-05
16:31:40 +0100 (Fri, 05 Mar 2010) | 1 line
Closes #3037. Review by extempore.
........
r21075 | odersky | 2010-03-05 16:32:03 +0100 (Fri, 05 Mar 2010) | 1 line
Closes #3026. Review by extempore.
........
r21076 | odersky | 2010-03-05 16:32:24 +0100 (Fri, 05 Mar 2010) | 1 line
Mixing test case. No review.
........
r21077 | odersky | 2010-03-05 16:58:27 +0100 (Fri, 05 Mar 2010) | 1 line
Closes #3015. Review by moors (it's his patch).
........
r21078 | extempore | 2010-03-05 19:17:26 +0100 (Fri, 05 Mar 2010) | 1 line
Cleaning up some redundancy martin noticed. No review. ........ r21079
| extempore | 2010-03-05 20:19:17 +0100 (Fri, 05 Mar 2010) | 2 lines
ScalaRunTime method to perform sameElements as fix for #2867. Review
by odersky. ........ r21080 | extempore | 2010-03-05 21:14:13 +0100
(Fri, 05 Mar 2010) | 1 line
Test case for case class equality. Closes #1332. No review. ........
r21081 | extempore | 2010-03-05 22:06:58 +0100 (Fri, 05 Mar 2010) | 5
lines
Fix for #3136 by reverting the line in r18184 which caused this and
other regressions. The downside is that the #1697 test case no longer
passes, but protracted shrug because it wasn't entirely fixed anyway.
Review by moors. (Can you triangulate your way to a patch where both
work simultaneously? It's today's bonus challenge!) ........ r21083 |
dcaoyuan | 2010-03-06 05:54:15 +0100 (Sat, 06 Mar 2010) | 1 line
escape source file path with space chars
........
r21084 | extempore | 2010-03-06 14:26:30 +0100 (Sat, 06 Mar 2010) | 3 lines
Fixes for #3126. Case class unapply methods now guard against null,
and thrown MatchErrors don't NPE trying to stringify null. No review.
........ r21085 | extempore | 2010-03-06 14:45:23 +0100 (Sat, 06 Mar
2010) | 2 lines
Modification to the last patch to return None/false rather than
throwing the MatchError. No review. ........ r21086 | extempore |
2010-03-07 06:24:00 +0100 (Sun, 07 Mar 2010) | 5 lines
One minute too many trying to figure out where some partest classpath
mutation was disappearing on me, and I snapped and started the process
of creating an immutable Settings. This commit is for the most part
infrastructure to enable its smooth and uneventful entrance. Review by
community. ........ r21087 | extempore | 2010-03-07 07:02:38 +0100 (Sun,
07 Mar 2010) | 2 lines
Still working my way through all the classpath manipulations in
partest. No review. ........ r21088 | extempore | 2010-03-07 19:53:07
+0100 (Sun, 07 Mar 2010) | 2 lines
Removed unnecessary DebugSetting, folding the small extra
functionality back into ChoiceSetting. No review. ........ r21091 |
rompf | 2010-03-07 21:52:45 +0100 (Sun, 07 Mar 2010) | 4 lines
- new immutable HashMap implementation based on a hash trie. this is the first iteration, more optimizations will be added later.
- updated test cases to reflect new ordering of elements
- made Map.empty and Set.empty singletons, deprecating classes Map.EmptyMap and Set.EmptySet
Review by extempore, odersky.
........
r21092 | extempore | 2010-03-08 07:06:36 +0100 (Mon, 08 Mar 2010) | 2 lines
More progress toward immutable Settings, and various cleanups
encountered along the way. No review. ........ r21093 | extempore |
2010-03-08 07:24:23 +0100 (Mon, 08 Mar 2010) | 6 lines
Created directory for code which is most likely dead but we want
to keep around a while in case someone else is using it. It's called
src/attic and now it holds four files. Motivations: such files cloud my
attempts to figure out what code in the compiler is really being used,
they require effort to maintain across changes, and they slow down every
build a fraction. Revew by community. ........ r21094 | milessabin |
2010-03-08 11:20:05 +0100 (Mon, 08 Mar 2010) | 1 line
Unbreak the IDE build following [21086]. No review. ........ r21098 |
dragos | 2010-03-08 14:14:59 +0100 (Mon, 08 Mar 2010) | 1 line
Recursively transform 'new' arguments in specialized programs. Closes
#3149, no review. ........ r21099 | odersky | 2010-03-08 14:34:57 +0100
(Mon, 08 Mar 2010) | 1 line
Closes #3026. Review by extempore.
........
r21100 | odersky | 2010-03-08 14:40:32 +0100 (Mon, 08 Mar 2010) | 1 line
Closes #3115. Reviw by rytz
........
r21101 | odersky | 2010-03-08 14:43:12 +0100 (Mon, 08 Mar 2010) | 1 line
Closes #3006. Review by milessabin because this could be a good basis
for shwoing implicits in the IDE. ........ r21102 | odersky | 2010-03-08
14:45:36 +0100 (Mon, 08 Mar 2010) | 1 line
Avoids two unchecked warnings. Review by extempore. ........ r21103 |
odersky | 2010-03-08 14:46:13 +0100 (Mon, 08 Mar 2010) | 1 line
new tests
........
r21105 | moors | 2010-03-08 15:27:48 +0100 (Mon, 08 Mar 2010) | 4 lines
closes #2994
make normalize slightly more aggressive in loading symbol info, while
tolerating the righteous cycle (use sym.info.typeParameters instead
of unsafeParams) this is needed to make sure higher-kinded types have
their type parameters (otherwise we'd get a PolyType with NoSymbol for
typeParams) ........ r21106 | phaller | 2010-03-08 16:01:53 +0100 (Mon,
08 Mar 2010) | 1 line
Reactor now has type parameter. Added Reactor.getState. Made
Reactor.start idempotent. Moved Actor.reactWithin to ReplyReactor.
Renamed Replyable to CanReply. ........ r21107 | odersky | 2010-03-08
19:12:11 +0100 (Mon, 08 Mar 2010) | 1 line
Refined fix for #2946. Review by extempore.
........
r21108 | phaller | 2010-03-08 19:17:50 +0100 (Mon, 08 Mar 2010) | 1 line
Closes #3102.
........
r21109 | extempore | 2010-03-08 19:46:35 +0100 (Mon, 08 Mar 2010) | 2 lines
Changed partest ant task not to use reflection, instead using the path
with which scala was invoked. No review. ........ r21110 | extempore |
2010-03-08 19:57:01 +0100 (Mon, 08 Mar 2010) | 2 lines
Fixed failing test t3115 via judicious application of
-Yfatal-warnings. No review. ........ r21111 | extempore | 2010-03-08
20:58:10 +0100 (Mon, 08 Mar 2010) | 8 lines
Added test.debug target to build.xml. This will run whatever
tests you have placed in the test/debug directories - critically
for those of us stuck debugging ant, this lets one run a small
selection of tests by way of ant instead of the console runner.
(Sorry about the empty .gitignore files, but one of git's quirks is
that it won't acknowledge the existence of an empty directory.) No
review. ........ r21113 | extempore | 2010-03-09 01:46:20 +0100 (Tue, 09
Mar 2010) | 2 lines
Temporarily disabling failing test until I can finish my partest work.
No review. ........ r21115 | phaller | 2010-03-09 11:35:13 +0100 (Tue,
09 Mar 2010) | 1 line
Made actor-getstate test more robust. No review.
........
r21121 | phaller | 2010-03-09 15:03:02 +0100 (Tue, 09 Mar 2010) | 1 line
New attempt at fixing the tests. No review.
........
r21123 | extempore | 2010-03-10 16:33:14 +0100 (Wed, 10 Mar 2010) | 1 line
Some windows oriented fixes for build.xml. No review. ........ r21124
| extempore | 2010-03-10 16:57:10 +0100 (Wed, 10 Mar 2010) | 1 line
Removed a couple infinite loops in XML. No review. ........ r21125 |
extempore | 2010-03-10 17:21:56 +0100 (Wed, 10 Mar 2010) | 2 lines
Some minor compiler support bits for my upcoming partest patch. No
review. ........ r21126 | extempore | 2010-03-10 17:30:51 +0100 (Wed, 10
Mar 2010) | 2 lines
...and a line from partest I didn't notice the absence of which would
break the build. No review. ........ r21127 | dubochet | 2010-03-10
17:32:10 +0100 (Wed, 10 Mar 2010) | 1 line
FatalError needs a stack trace. No review (was discussed at Scala
meeting). ........ r21128 | moors | 2010-03-10 18:43:20 +0100 (Wed, 10
Mar 2010) | 5 lines
closes #3152: refactored adjustTypeArgs and methTypeArgs so that
tparams are correctly split into ones that were inferred successfully,
and that thus have a corresponding type argument, and those that weren't
determined
I didn't investigate the exact cause of the final error message in the
bug report, but Jason Zaugg's observations seems correct and I never
liked that uninstantiated buffer in the first place.
review by odersky
........
r21129 | moors | 2010-03-10 18:50:15 +0100 (Wed, 10 Mar 2010) | 1 line
slight (syntactic) cleanup of patch for see #3152 -- sorry, only realised when looking over my patch again
........
r21130 | extempore | 2010-03-10 20:18:43 +0100 (Wed, 10 Mar 2010) | 2 lines
Small syntactic adjustment so that last patch from adriaan will build.
(Big thumsb up to the aesthetics though.) No review. ........ r21131 |
extempore | 2010-03-11 07:00:37 +0100 (Thu, 11 Mar 2010) | 1 line
Some IO conveniences. No review.
........
r21135 | odersky | 2010-03-11 15:21:21 +0100 (Thu, 11 Mar 2010) | 1 line
Closes #2940. Review by extempore. My original idea to replace
existrentialAbstraction by existentialType in ClassfileParsers was
correct after all. However this change triggered another landmine in
Definitions, where ClassType queried unsafeTypeParams. I think that was
only needed for the migration to Java generics in 2.7, so it can safely
go away now. Because the change in classfile parsers forces less of
a type, unsafeTtpeParams returned the wrong result, which caused the
build to fail. The modifications in Erasure and Implicits were attempts
to isolate the problem before. They seem to be unnecessary to make
the build go through, but are cleaner than the previous versions they
replace. ........ r21136 | odersky | 2010-03-11 15:22:29 +0100 (Thu, 11
Mar 2010) | 1 line
Fixed doc comment. No review.
........
r21137 | odersky | 2010-03-11 17:34:44 +0100 (Thu, 11 Mar 2010) | 1 line
Closes #3157 by overriding +: in List. Review by rompf ........ r21138
| rompf | 2010-03-11 17:44:06 +0100 (Thu, 11 Mar 2010) | 1 line
implemented handling of 32-bit collisions in immutable.HashMap. review
by community. ........ r21139 | odersky | 2010-03-11 17:53:54 +0100
(Thu, 11 Mar 2010) | 1 line
Closes #3158. No review necessary.
........
r21140 | rompf | 2010-03-11 17:55:38 +0100 (Thu, 11 Mar 2010) | 2 lines
moved the continuations plugin into trunk. it is now part of the
distributions under /plugins/continuations.jar which should make
scalac load it by default. actual use however must be enabled by
passing -P:continuations:enable as command line arg. supporting library
code is in package scala.util.continuations and is compiled into
scala-library.jar. review by rytz, cunei, odersky. ........ r21141 |
odersky | 2010-03-11 18:11:24 +0100 (Thu, 11 Mar 2010) | 1 line
Partially reverted r21018. Closes #3153. No review. ........ r21142 |
rompf | 2010-03-11 21:36:43 +0100 (Thu, 11 Mar 2010) | 1 line
added missing file from last commit. no review.
........
r21148 | Joshua.Suereth | 2010-03-12 14:34:05 +0100 (Fri, 12 Mar 2010) | 1 line
Added continuations to maven deployment. review by rompf ........
r21149 | plocinic | 2010-03-12 16:21:25 +0100 (Fri, 12 Mar 2010) | 1
line
do not set the type of the implementation method to be the type of the
original one as this is done properly in cloneSymbol. no review (already
done by Martin) ........ r21150 | odersky | 2010-03-12 16:38:33 +0100
(Fri, 12 Mar 2010) | 1 line
Closes #3143. Review by moors.
........
r21151 | odersky | 2010-03-12 19:39:40 +0100 (Fri, 12 Mar 2010) | 1 line
Added an object to mangle byte arrays into Java classfile's version of
UTF8. ........ r21156 | odersky | 2010-03-13 18:32:19 +0100 (Sat, 13 Mar
2010) | 2 lines
Disabled failing test
........
r21157 | odersky | 2010-03-13 18:33:33 +0100 (Sat, 13 Mar 2010) | 2 lines
Closes #3120. Review by extempore.
........
r21158 | odersky | 2010-03-13 18:34:13 +0100 (Sat, 13 Mar 2010) | 2 lines
Improved version where bumping and zero-encoding are rolled into one.
........ r21159 | extempore | 2010-03-13 20:24:43 +0100 (Sat, 13 Mar
2010) | 2 lines
More support code for the big partest patch I'm working on to finally
finish classpaths for good. No review. ........ r21160 | odersky |
2010-03-13 21:21:13 +0100 (Sat, 13 Mar 2010) | 2 lines
Closes #2918. Review by moors.
........
r21162 | extempore | 2010-03-14 07:57:36 +0100 (Sun, 14 Mar 2010) | 1 line
Test case closes #751. No review.
........
r21163 | extempore | 2010-03-14 07:58:02 +0100 (Sun, 14 Mar 2010) | 1 line
Test case for #2940. No review.
........
r21164 | extempore | 2010-03-14 08:25:15 +0100 (Sun, 14 Mar 2010) | 1 line
Tighten update check in cleanup. Closes #3175. No review. ........
r21165 | rompf | 2010-03-14 18:39:56 +0100 (Sun, 14 Mar 2010) | 1 line
improved immutable HashMap iterator. review by community. ........
r21167 | extempore | 2010-03-15 05:45:47 +0100 (Mon, 15 Mar 2010) | 20
lines
Leveraged -Xmigration to burn off some warts which arose in the new
collections. Warnings put in place for behavioral changes, allowing
the following. 1) Buffers: create new collections on
++ and -- like all the other collections. 2) Maps: eliminated
never-shipped redundant method valuesIterable and supplied these
return types:
def keys: Iterable[A]
def keysIterator: Iterator[A]
def values: Iterable[B]
def valuesIterator: Iterator[B]
def keySet: Set[A]
I concluded that keys should return Iterable because keySet also
exists on Map, and is not solely in the province of Maps even if we
wanted to change it: it's defined on Sorted and also appears in some
Sets. So it seems sensible to have keySet return a Set and keys return
the more general type.
Closes #3089, #3145. Review by odersky.
........
r21168 | extempore | 2010-03-15 06:19:53 +0100 (Mon, 15 Mar 2010) | 2 lines
Reverting a couple replacements from that last patch which don't
look so safe on re-examination. No review. ........ r21171 | rytz |
2010-03-15 11:25:34 +0100 (Mon, 15 Mar 2010) | 1 line
Fix for msil compiler. Unlike java.lang.Class, System.Type does not
take a type parameter. Related to r21135. review by odersky. ........
r21174 | prokopec | 2010-03-15 11:44:27 +0100 (Mon, 15 Mar 2010) | 1
line
Fixes #3155. No review is necessary.
........
r21175 | prokopec | 2010-03-15 12:03:03 +0100 (Mon, 15 Mar 2010) | 1 line
Fixes #3132. No review necessary.
........
r21176 | prokopec | 2010-03-15 13:44:32 +0100 (Mon, 15 Mar 2010) | 1 line
Fixes #3086. Review by community.
........
r21177 | rompf | 2010-03-15 14:44:53 +0100 (Mon, 15 Mar 2010) | 1 line
new immutable.HashSet. review by community.
........
r21178 | rytz | 2010-03-15 14:54:23 +0100 (Mon, 15 Mar 2010) | 1 line
minor cleanup to build.xml. review by rompf
........
r21179 | prokopec | 2010-03-15 15:45:33 +0100 (Mon, 15 Mar 2010) | 1 line
Fixes #3091. Review by community.
........
r21180 | rompf | 2010-03-15 16:48:28 +0100 (Mon, 15 Mar 2010) | 1 line
fixed treatment of annotated types in isNumericSubType. re-enabled
test case. review by odersky ........ r21181 | extempore | 2010-03-15
18:08:16 +0100 (Mon, 15 Mar 2010) | 3 lines
Tracked down docs.lib build issue from the dentist's chair while
waiting for my teeth to numb. Checking in over open wireless access
point. This is dedication. No review. ........ r21184 | rompf |
2010-03-16 09:19:59 +0100 (Tue, 16 Mar 2010) | 1 line
added support for continuations in try/catch blocks. review by
community. ........ r21186 | prokopec | 2010-03-16 10:59:37 +0100 (Tue,
16 Mar 2010) | 1 line
Changed `!=` to `ne` for #3086. No review.
........
r21187 | prokopec | 2010-03-16 14:10:45 +0100 (Tue, 16 Mar 2010) | 1 line
Fixes #3091. Review by community.
........
r21188 | prokopec | 2010-03-16 15:23:13 +0100 (Tue, 16 Mar 2010) | 1 line
Fixes infinite streams in #3091. No review.
........
r21189 | odersky | 2010-03-16 15:40:43 +0100 (Tue, 16 Mar 2010) | 1 line
Closes #3180. No review.
........
r21190 | odersky | 2010-03-16 15:42:09 +0100 (Tue, 16 Mar 2010) | 1 line
Fixes nitpicks by Adriaan in his review. No review necessary. ........
r21193 | odersky | 2010-03-16 16:26:33 +0100 (Tue, 16 Mar 2010) | 2
lines
Closes #2913. Review by rytz. (The error was that too few/too many
argument errors had a position different from the other errors, so no
second try was done for them.) ........ r21195 | odersky | 2010-03-16
17:12:46 +0100 (Tue, 16 Mar 2010) | 1 line
new tests
........
r21196 | odersky | 2010-03-16 17:22:44 +0100 (Tue, 16 Mar 2010) | 1 line
Closes #2688 by disallowing call-by-name implicit parameters. No
review. ........ r21199 | odersky | 2010-03-16 22:07:16 +0100 (Tue, 16
Mar 2010) | 2 lines
Fixed build problem by eliminiating a redundant implicit in scalap.
Review by extempore. ........ r21200 | rompf | 2010-03-16 22:53:07 +0100
(Tue, 16 Mar 2010) | 1 line
added test case for #2417. no review
........
r21201 | rompf | 2010-03-17 00:06:10 +0100 (Wed, 17 Mar 2010) | 1 line
closes #3112. no review.
........
r21205 | phaller | 2010-03-17 12:07:50 +0100 (Wed, 17 Mar 2010) | 1 line
Closes #3185. Review by plocinic.
........
r21206 | milessabin | 2010-03-17 14:16:09 +0100 (Wed, 17 Mar 2010) | 1 line
Continuations support classes are included in scala-library.jar
so their sources should be in scala-library-src.jar. Also export
scala.util.continuations from the scala-library bundle. ........ r21207
| plocinic | 2010-03-17 17:02:42 +0100 (Wed, 17 Mar 2010) | 1 line
Closes #3133. Review by community.
........
r21210 | prokopec | 2010-03-18 11:23:26 +0100 (Thu, 18 Mar 2010) | 1 line
Reverse didn't work for empty ranges. Review by extempore. ........
r21214 | plocinic | 2010-03-19 10:09:00 +0100 (Fri, 19 Mar 2010) | 1
line
Fixes #3054. No review.
........
r21215 | dubochet | 2010-03-19 14:29:42 +0100 (Fri, 19 Mar 2010) | 1 line
Updated SVN ignore patterns. No review.
........
r21216 | phaller | 2010-03-19 18:03:14 +0100 (Fri, 19 Mar 2010) | 1 line
Closes #2827. Review by community.
........
r21217 | odersky | 2010-03-19 18:35:58 +0100 (Fri, 19 Mar 2010) | 2 lines
Spring cleaning of collection libraries. Closes #3117 by forcing a
view when nothing else can be done. If people think some operations
can be more lazy, please provide patches/do changes. Also brought
proxies and forwarders into line. ........ r21218 | odersky | 2010-03-19
18:36:46 +0100 (Fri, 19 Mar 2010) | 1 line
new version of decode that does not need a length. Moved test code to
tests. ........ r21219 | extempore | 2010-03-19 20:38:24 +0100 (Fri, 19
Mar 2010) | 15 lines
More fun with -Xmigration. Followed through on the changes to
BufferLike (++ and similar now create a new collection.)
Removed MapLikeBase. Annotated all the methods in mutable.{ Map, Set }
which mutated in-place in 2.7 to note that they create new
collections, and implemented same.
At this point the only +/- like method which mutates in place which I
am aware of is BufferLike.+ (see source comment for my observations.)
Also tweaked some collections return types as necessitated by these
changes, such as mutable.Set.clone() now returning "This" rather than
mutable.Set[A].
References #3089, closes #3179. Review by odersky. ........ r21220 |
milessabin | 2010-03-19 22:34:32 +0100 (Fri, 19 Mar 2010) | 1 line
Added a tryToSetFromPropertyValue implementation for
MultiStringSetting. ........ r21222 | extempore | 2010-03-19 22:48:42
+0100 (Fri, 19 Mar 2010) | 5 lines
Returning to the thrilling world of equality and hashCodes now
that Any.## is a reality. Moved the hash functions from Predef to
ScalaRunTime, and made what appears to be an optimization to equals
by not losing the result of an instanceof test. Review by community.
........ r21223 | extempore | 2010-03-19 23:37:13 +0100 (Fri, 19 Mar
2010) | 3 lines
Half-disabled productElementName until I have time to reimplement it
more to martin's liking. ("Half" because full disabling is not possible
until starr has forgotten about it.) No review. ........ r21224 |
extempore | 2010-03-20 05:24:39 +0100 (Sat, 20 Mar 2010) | 3 lines
Some work on the Array methods as they manifest in refinement types:
tightening when Array code is generated and also what code is generated.
Review by dubochet. ........ r21225 | extempore | 2010-03-21 01:21:54
+0100 (Sun, 21 Mar 2010) | 6 lines
Some minor changes in scala.swing.* which I was glancing through
because of #3196. I noticed the Font object was in package scala instead
of scala.swing, which looks sure to be a mistake (an easy one to make,
and one others have made as well, because we're not entirely used to
package objects.) I didn't want to accidentally ship a scala.Font so I
moved it into swing. Review by imaier. ........ r21226 | extempore |
2010-03-21 01:22:22 +0100 (Sun, 21 Mar 2010) | 5 lines
During my last look at r21224 I noticed what must be a long standing
bug in Array.update handling. Fixing this probably never to be noticed
corner case (see bug3175.scala) seduced me into drumming out some
duplication. At least we got some nice commenting out of it. Review by
dubochet. ........ r21227 | extempore | 2010-03-22 00:00:14 +0100 (Mon,
22 Mar 2010) | 1 line
Some support code related to partest changes. No review. ........
r21228 | rompf | 2010-03-22 17:52:10 +0100 (Mon, 22 Mar 2010) | 1 line
closes #3199. review by community.
........
r21229 | extempore | 2010-03-22 23:09:58 +0100 (Mon, 22 Mar 2010) | 4 lines
Consistency work on Addable and Growable. Deprecated '+' on all
Seq-derived classes. Creating GrowingBuilder to complement AddingBuilder
on classes with += but not +. Fixed some inconsistencies I came across
in the process. No review. ........ r21230 | extempore | 2010-03-23
00:02:50 +0100 (Tue, 23 Mar 2010) | 5 lines
Noticed we still have a bunch of collection classes which are rather
lacking. Did some integration, added some companion objects. Not
thrilled with the overall picture in there, there's still a lot which
should be done. Updated a deprecation message, closes #3202. No review.
........ r21231 | extempore | 2010-03-23 05:17:59 +0100 (Tue, 23 Mar
2010) | 17 lines
Went ahead and implemented classpaths as described in email to
scala-internals on the theory that at this point I must know what I'm
doing.
** PUBLIC SERVICE ANNOUNCEMENT **
If your code of whatever kind stopped working with this commit (most
likely the error is something like "object scala not found") you can
get it working again with either of:
passing -usejavacp on the command line
set system property "scala.usejavacp" to "true"
Either of these will alert scala that you want the java application
classpath to be utilized by scala as well.
Review by community.
........
r21232 | extempore | 2010-03-23 07:08:55 +0100 (Tue, 23 Mar 2010) | 4 lines
Fix for #3204. This is a really good example of the issues that can
arise when return types of public facing methods are inferred. We
eventually need some mechanism to make such issues easier to avoid. No
review. ........ r21233 | extempore | 2010-03-23 07:26:08 +0100 (Tue, 23
Mar 2010) | 3 lines
You try to get away with one little line of uncompiled patch...
reverting last patch since I'm too tired to see why it broke the build.
No review. ........ r21234 | dubochet | 2010-03-23 15:38:11 +0100 (Tue,
23 Mar 2010) | 7 lines
Scala signature is generated as an annotation (that is accessible
through Java reflection).
- compiler generates all pickled Scala signatures as annotations to class files.
- compiler can read class files with signature as annotations or old-style signatures as attributes.
- Scalap has also been updated to new signatures (contributed by Ilya Sergey: thanks a lot).
- FJBG updated to allow entering constant pool strings as byte arrays.
- ByteCodecs decode method returns the length of the decoded array.
Review by ilyas. Already mostly reviewed by odersky.
........
r21235 | phaller | 2010-03-23 16:11:05 +0100 (Tue, 23 Mar 2010) | 1 line
Fixes #3186. Closes #2214.
........
r21236 | phaller | 2010-03-23 16:23:39 +0100 (Tue, 23 Mar 2010) | 1 line
Added test case for #3186. Closes #3186.
........
r21237 | dragos | 2010-03-23 17:29:38 +0100 (Tue, 23 Mar 2010) | 1 line
Closed #3195. Review by extempore.
........
r21238 | extempore | 2010-03-23 17:52:51 +0100 (Tue, 23 Mar 2010) | 2 lines
Although it was working fine, a test case for @elidable to make sure
that state of affairs continues. No review. ........ r21239 | extempore
| 2010-03-23 18:26:23 +0100 (Tue, 23 Mar 2010) | 2 lines
Added some documentation to the methods in Predef which utilize
@elidable. No review. ........ r21240 | extempore | 2010-03-23 19:51:08
+0100 (Tue, 23 Mar 2010) | 1 line
Fix and test case for #3169.
........
r21241 | extempore | 2010-03-23 20:13:43 +0100 (Tue, 23 Mar 2010) | 13 lines
You know Cutty McPastington is having a good time when you can find
this logic in two different files:
('A' <= c && c <= 'Z') ||
('a' <= c && c <= 'a') ||
How could that possibly work, you might ask. After a series of ||s,
the last condition subsumes most of the previous ones:
Character.isUnicodeIdentifierStart(c)
thereby saving us from a world where the only legal lower case
identifiers are a, aa, aaa, aaaa, and a few others. No review. ........
r21242 | extempore | 2010-03-23 21:16:51 +0100 (Tue, 23 Mar 2010) | 2
lines
Remedied accidental obscuring of -X, -Y, and -P in the standard help
output. No review. ........ r21243 | dubochet | 2010-03-23 21:23:49
+0100 (Tue, 23 Mar 2010) | 1 line
Fixed build. Partial revert of r21234. All the infrastructure to read
new-style signatures is still in, but the compiler again generates
old-style signatures. ........ r21244 | extempore | 2010-03-23 22:58:49
+0100 (Tue, 23 Mar 2010) | 2 lines
Removed ArgumentsExpander in favor of having all arguments parsed the
same way. No review. ........ r21245 | phaller | 2010-03-24 10:58:24
+0100 (Wed, 24 Mar 2010) | 1 line
Fixed the serialization test. Restored the test to use the semantics
of Enumeration#equals in 2.7. Made caching of Enumeration objects thread
safe. See #3186. Review by extempore. ........ r21246 | odersky |
2010-03-24 15:23:40 +0100 (Wed, 24 Mar 2010) | 1 line
Fixes problematic equality of En umeration values. ........ r21247 |
odersky | 2010-03-24 15:29:04 +0100 (Wed, 24 Mar 2010) | 1 line
Fixes problematic equality of Enumeration values. ........ r21248 |
odersky | 2010-03-24 15:43:45 +0100 (Wed, 24 Mar 2010) | 1 line
Closes #3187. No review.
........
r21249 | extempore | 2010-03-24 16:37:50 +0100 (Wed, 24 Mar 2010) | 3 lines
Reverted a presumably unintentional reincarnation of old predef (these
functions are in ScalaRunTime now.) Review by odersky just in case there
was a secret plan. ........ r21250 | dubochet | 2010-03-24 16:54:21
+0100 (Wed, 24 Mar 2010) | 1 line
Scala signature is generated as an annotation, second try. Review by
dragos. ........ r21252 | odersky | 2010-03-24 17:20:32 +0100 (Wed, 24
Mar 2010) | 1 line
new readme. no review.
........
r21253 | extempore | 2010-03-24 17:23:48 +0100 (Wed, 24 Mar 2010) | 2 lines
Fixed an issue with no-parameter-list methods not being elided. No
review. ........ r21254 | dubochet | 2010-03-24 17:59:22 +0100 (Wed, 24
Mar 2010) | 5 lines
[scaladoc] Improved Scaladoc comment syntax, contributed by Pedro
Furlanetto.
- Wiki syntax supports nested, numbered and unnumbered lists;
- Wiki syntax supports links (entity links currently require fully qualified names);
- Stars no longer are mandatory to start comment lines.
Already reviewed by dubochet; no review.
........
r21256 | extempore | 2010-03-24 18:18:03 +0100 (Wed, 24 Mar 2010) | 6 lines
Renamed partialMap to collect. There was a deprecated no-argument
method on Iterator called collect which I had to remove, because if
the method is overloaded it puts a bullet in the type inference, an
intolerable result for a function which takes a partial function as its
argument. I don't think there's much chance of confusion, but I put a
migration warning on collect just in case. No review. ........ r21257 |
phaller | 2010-03-24 18:29:59 +0100 (Wed, 24 Mar 2010) | 1 line
Addresses see #2017. Documents class scala.actors.Exit. Review by
community. ........ r21258 | phaller | 2010-03-24 18:31:37 +0100 (Wed,
24 Mar 2010) | 1 line
Adds tests for see #2017.
........
r21259 | extempore | 2010-03-24 18:34:54 +0100 (Wed, 24 Mar 2010) | 1 line
Fixed a test case I broke with the collect rename. No review. ........
r21260 | rompf | 2010-03-24 18:55:15 +0100 (Wed, 24 Mar 2010) | 1 line
continuations plugin will now report a nice error message if it is
not enabled and encounters an @cps expression. review by rytz ........
r21261 | extempore | 2010-03-24 20:47:41 +0100 (Wed, 24 Mar 2010) | 1
line
Apparently I can't fix a test case to save my life. No review.
........ r21262 | rompf | 2010-03-24 23:43:44 +0100 (Wed, 24 Mar 2010) |
1 line
reverting changes from r21260. there is a deeper problem that causes
the plugin to be loaded twice but only one instance receives the enable
flag (hence, the other one complains). no review ........ r21263 |
phaller | 2010-03-25 09:52:08 +0100 (Thu, 25 Mar 2010) | 1 line
Makes two actor tests deterministic. No review.
........
r21264 | phaller | 2010-03-25 13:46:01 +0100 (Thu, 25 Mar 2010) | 1 line
Removed obsolete version numbers. No review.
........
r21265 | phaller | 2010-03-25 14:14:28 +0100 (Thu, 25 Mar 2010) | 1 line
Renamed Replyable* types to *CanReply. No review. ........ r21266 |
phaller | 2010-03-25 14:18:23 +0100 (Thu, 25 Mar 2010) | 1 line
Renamed Replyable* source files to the types they define. No review.
........ r21269 | dragos | 2010-03-25 15:22:30 +0100 (Thu, 25 Mar 2010)
| 1 line
Fixed order of fields in the generated code. No review. ........
r21271 | rompf | 2010-03-25 17:14:56 +0100 (Thu, 25 Mar 2010) | 1 line
fixed double-loading of plugins. reinstated not-enabled error msg
for cps plugin. review by community. ........ r21273 | extempore |
2010-03-25 17:59:14 +0100 (Thu, 25 Mar 2010) | 2 lines
New scalacheck jar because recent Actor changes broke binary
compatibility. No review. ........ r21274 | extempore | 2010-03-25
20:55:53 +0100 (Thu, 25 Mar 2010) | 15 lines
While working on partest discovered that CompilerCommand ignores half
its constructor arguments and a couple dozen places blithely pass it
those arguments as if they're being used. Then there were setups like
this:
class OfflineCompilerCommand(
arguments: List[String],
settings: Settings,
error: String => Unit,
interactive: Boolean)
extends CompilerCommand(arguments, new Settings(error), error, false)
Hey offline compiler command, why throw away the perfectly good
settings you were given? Ever heard 'reduce, reuse, recycle'? How did
you ever work... or do you? No review. ........ r21275 | odersky |
2010-03-25 21:21:45 +0100 (Thu, 25 Mar 2010) | 2 lines
I think this closes #2433. Only verified by synthetic test case t2433
which crashed before and compiles now. Review by extempore. ........
r21276 | extempore | 2010-03-25 22:53:58 +0100 (Thu, 25 Mar 2010) | 7
lines
Altered classpath behavior when no default is given. Now in that
case the contents of environment variable CLASSPATH will be used as
the scala user classpath, and only if that is not present will "." be
used. Be advised that there are still various "hand assembled" sorts of
classpaths in trunk, and there's not yet any way to ensure they honor
this; things which use the normal Settings object should do the right
thing. No review. ........ r21278 | extempore | 2010-03-26 05:26:03
+0100 (Fri, 26 Mar 2010) | 1 line
Some minor I/O changes. No review.
........
r21279 | extempore | 2010-03-26 05:59:58 +0100 (Fri, 26 Mar 2010) | 2 lines
Tweaked help output a little further so -Y isn't visible except to
those who consider themselves advanced. No review. ........ r21280 |
extempore | 2010-03-26 13:20:18 +0100 (Fri, 26 Mar 2010) | 1 line
Fix for #3204. No review.
........
r21281 | dubochet | 2010-03-26 15:34:34 +0100 (Fri, 26 Mar 2010) | 1 line
Unparsed Scala signature annotations are not added to the symbol
table. Review by dragos. ........ r21282 | ilyas | 2010-03-26 16:53:05
+0100 (Fri, 26 Mar 2010) | 1 line
missing quotes for annotation values added
........
r21283 | ilyas | 2010-03-26 17:07:39 +0100 (Fri, 26 Mar 2010) | 1 line
some output polishing
........
r21284 | rompf | 2010-03-26 18:35:31 +0100 (Fri, 26 Mar 2010) | 1 line
improvements to cps exception handling. among other things, finally
clauses are now illegal for cps try/catch blocks. transforming them
correctly is prohibitively tricky. review by community. review by
community. ........ r21285 | extempore | 2010-03-27 06:41:47 +0100 (Sat,
27 Mar 2010) | 1 line
TraversableOnce. Review by odersky.
........
r21286 | imaier | 2010-03-28 13:34:48 +0200 (Sun, 28 Mar 2010) | 1 line
Fixed #3090
........
r21287 | imaier | 2010-03-28 14:28:39 +0200 (Sun, 28 Mar 2010) | 1 line
Fixed #2803. Added warning for UIElement.cachedWrapper. ........
r21288 | imaier | 2010-03-28 15:01:28 +0200 (Sun, 28 Mar 2010) | 1 line
Fix for #2980. No review.
........
r21289 | imaier | 2010-03-28 15:15:31 +0200 (Sun, 28 Mar 2010) | 1 line
Fixed #2753. No review.
........
r21290 | imaier | 2010-03-28 15:27:42 +0200 (Sun, 28 Mar 2010) | 1 line
Fixed #3219. No review.
........
r21291 | imaier | 2010-03-28 15:56:18 +0200 (Sun, 28 Mar 2010) | 1 line
Fixed #2242. No review.
........
r21292 | rompf | 2010-03-29 11:55:44 +0200 (Mon, 29 Mar 2010) | 1 line
closes 2864. closes 2934. closes 3223. closes 3225. review by
community. ........ r21294 | dubochet | 2010-03-29 14:40:39 +0200 (Mon,
29 Mar 2010) | 1 line
Fix to the way Scalap decodes ScalaSignature annotations. Contributed
by ilyas. Already reviewed by dubochet, no review. ........ r21295 |
odersky | 2010-03-29 14:53:07 +0200 (Mon, 29 Mar 2010) | 1 line
Closes #2386 by requiring class manifests for an array element type if
a class manifaest for the array type is demanded. Review by dubochet.
........ r21296 | dubochet | 2010-03-29 15:14:10 +0200 (Mon, 29 Mar
2010) | 1 line
Reverted file that was unintentionally committed as part of r21294.
........ r21297 | milessabin | 2010-03-29 15:38:11 +0200 (Mon, 29 Mar
2010) | 1 line
Patch from Mirko Stocker to add position information to val/var
modifiers on ctor params for use by tools. Review by odersky. ........
r21299 | rompf | 2010-03-29 21:22:50 +0200 (Mon, 29 Mar 2010) | 1 line
fixes the unfounded "name clash between inherited members" error.
review by dragos. ........ r21303 | dubochet | 2010-03-30 20:37:25 +0200
(Tue, 30 Mar 2010) | 1 line
[scaladoc] Fixed the nightly build. Wiki parser correctly handles
lists with unknown bullet kind. No review. ........ r21304 | extempore |
2010-03-30 23:25:16 +0200 (Tue, 30 Mar 2010) | 3 lines
Noticed that the implementation of toArray Iterator had acquired via
TraversableOnce called "size" to allocate the array, leaving a nice
empty iterator to actually populate it. Fixed. No review. ........
r21305 | rompf | 2010-03-31 14:20:41 +0200 (Wed, 31 Mar 2010) | 1 line
closes #3203, overriding more of the TraversableLike methods. also
tightened access privileges to internal fields and methods. review by
community. ........ r21307 | rytz | 2010-03-31 16:00:09 +0200 (Wed, 31
Mar 2010) | 1 line
close #3222. review by community
........
r21309 | rytz | 2010-03-31 18:56:40 +0200 (Wed, 31 Mar 2010) | 1 line
close #3183. review by community
........
r21313 | rytz | 2010-04-01 10:39:11 +0200 (Thu, 01 Apr 2010) | 1 line
close #3178. review by community
........
r21322 | rompf | 2010-04-02 15:11:23 +0200 (Fri, 02 Apr 2010) | 1 line
closes #3242. review by community.
........
r21323 | extempore | 2010-04-02 23:09:34 +0200 (Fri, 02 Apr 2010) | 5 lines
Mostly IO tweaks related to my upcoming partest patch, which to my
chagrin is being held up by windows. Also updates the default ANT_OPTS
to be the same as the ones the nightlies override it with. (If we know
you can't build scala with those settings it seems kind of uncool to
leave them for everyone else.) No review. ........ r21324 | rompf |
2010-04-03 18:07:58 +0200 (Sat, 03 Apr 2010) | 1 line
improved cps transform of partial functions. no review. ........
r21325 | dubochet | 2010-04-03 22:13:19 +0200 (Sat, 03 Apr 2010) | 1
line
[scaladoc] Considerably reduced size of documentation by not
generating certain strange inner classes. Scaladoc is much much faster
(more than 10x on library); not exactly clear why. Protected members are
printed in documentation and displayed on demand. Review by malayeri.
........ r21326 | extempore | 2010-04-04 04:58:11 +0200 (Sun, 04 Apr
2010) | 2 lines
Nipped the infinite loop which is presently launched by an attempt to
run test.continuations.suite with -optimise. No review. ........ r21327
| rompf | 2010-04-04 15:14:44 +0200 (Sun, 04 Apr 2010) | 1 line
workaround for #3252. review by extempore.
........
r21328 | extempore | 2010-04-04 18:59:25 +0200 (Sun, 04 Apr 2010) | 1 line
Removing a class cast exception. Closes #2843, no review. ........
r21329 | extempore | 2010-04-05 08:24:22 +0200 (Mon, 05 Apr 2010) | 13
lines
If I work on this patch any longer without checking in I will go
stark raving mad. It is broken up into a couple pieces. This one is
the changes to test/. It includes fixing a bunch of tests, removing
deprecated constructs, moving jars used by tests to the most specific
plausible location rather than having all jars on the classpath of
all tests, and some filesystem layout change (continuations get their
whole own srcpath.) This would be the world's most tedious review, so
let's say no review.
[Note: after this commit, I doubt things will build very smoothly
until the rest of the partest changes follow. Which should only be
seconds, but just in case.] ........ r21330 | extempore | 2010-04-05
08:25:16 +0200 (Mon, 05 Apr 2010) | 7 lines
The code part of the partest patch. If anyone wants to review it they
can be my guest (reviewbot: review by community!) More realistically:
more than likely I have unwittingly altered or impaired some piece of
functionality used by someone somewhere. Please alert me if this is the
case and I will remedy it. I have to call it at this point as the best
interests of 2.8 cannot be served by me nursing this patch along any
further. ........ r21331 | odersky | 2010-04-05 15:47:27 +0200 (Mon, 05
Apr 2010) | 2 lines
Rearranging IndexedSeq/LinearSeq and related work ........ r21332 |
odersky | 2010-04-05 18:53:53 +0200 (Mon, 05 Apr 2010) | 2 lines
Made Vector the standard impl of IndexedSeq. Review by rompf. ........
r21333 | extempore | 2010-04-05 19:40:59 +0200 (Mon, 05 Apr 2010) | 1
line
Typo patrol, no review.
........
r21341 | extempore | 2010-04-06 02:40:25 +0200 (Tue, 06 Apr 2010) | 1 line
A removal that didn't take. No review.
........
r21342 | extempore | 2010-04-06 02:42:50 +0200 (Tue, 06 Apr 2010) | 4 lines
Fix for the partest task to fail the build when a test fails, and
fixes for 2/3 of the quietly failing tests. I'm not quite sure what to
do about the view ones, it doesn't look like a simple rename is going to
cut it, so: review by odersky. ........ r21343 | extempore | 2010-04-06
03:26:31 +0200 (Tue, 06 Apr 2010) | 5 lines
As a brief diversion from real work, implemented Damerau–Levenshtein
and ran it on trunk to elicit obvious misspellings. Unfortunately
they're mostly in places like compiler comments which real people
never see, but I fixed them anyway. All those English Lit majors who
peruse our sources are sure to be pleased. No review. ........ r21344 |
extempore | 2010-04-06 04:05:20 +0200 (Tue, 06 Apr 2010) | 1 line
Noticed a bug with test obj dirs not getting deleted. No review.
........ r21345 | extempore | 2010-04-06 07:18:46 +0200 (Tue, 06 Apr
2010) | 2 lines
A couple more bits of partest I discovered weren't doing their jobs.
Some of my classiest messages were going unheard! No review. ........
r21346 | extempore | 2010-04-06 07:19:19 +0200 (Tue, 06 Apr 2010) | 2
lines
Some tweaks to classpath handling I had left over from trying to
figure out the continuations plugin issue. No review. ........ r21347 |
imaier | 2010-04-06 13:43:00 +0200 (Tue, 06 Apr 2010) | 1 line
Fixed #3257
........
r21348 | odersky | 2010-04-06 15:53:39 +0200 (Tue, 06 Apr 2010) | 1 line
Optimized toArray for ArrayOps and WrappedArrays. Changed printing
of Views. Fixed IndexedseqView problems. Review by extempore. ........
r21349 | prokopec | 2010-04-06 16:39:51 +0200 (Tue, 06 Apr 2010) | 1
line
Fixes #2535. Review by community.
........
r21350 | prokopec | 2010-04-06 16:56:14 +0200 (Tue, 06 Apr 2010) | 1 line
Forgot to add scalacheck test for #2535. Review by community. ........
r21351 | extempore | 2010-04-06 17:09:02 +0200 (Tue, 06 Apr 2010) | 1
line
Final methods should appear in scaladoc. Closes #3067, no review.
........ r21353 | extempore | 2010-04-06 20:27:29 +0200 (Tue, 06 Apr
2010) | 1 line
Removing some code duplication from scaladoc. Review by dubochet.
........ r21354 | extempore | 2010-04-07 00:46:22 +0200 (Wed, 07 Apr
2010) | 5 lines
Fixed another partest feature I'd managed to break at the very last
minute. When a test is too slow finishing, there will be messages
identifying the test. It defaults to 90 seconds before the first warning
because I know some machines are slow, but it'd be nice if that was more
like 30. No review. ........ r21356 | extempore | 2010-04-07 01:57:11
+0200 (Wed, 07 Apr 2010) | 2 lines
And another partest gap is filled. Now if you pass --quick to partest
it really will use quick as the build dir. No review. ........
Diffstat (limited to 'src/actors')
41 files changed, 730 insertions, 695 deletions
diff --git a/src/actors/scala/actors/AbstractActor.scala b/src/actors/scala/actors/AbstractActor.scala index 9c72b307fa..9cc62a1cde 100644 --- a/src/actors/scala/actors/AbstractActor.scala +++ b/src/actors/scala/actors/AbstractActor.scala @@ -13,12 +13,11 @@ package scala.actors /** * The <code>AbstractActor</code> trait. * - * @version 0.9.18 * @author Philipp Haller */ -trait AbstractActor extends OutputChannel[Any] with Replyable[Any, Any] { +trait AbstractActor extends OutputChannel[Any] with CanReply[Any, Any] { - private[actors] var exiting = false + private[actors] def exiting: Boolean = false private[actors] def linkTo(to: AbstractActor): Unit diff --git a/src/actors/scala/actors/AbstractReactor.scala b/src/actors/scala/actors/AbstractReactor.scala index 5c4b082cff..d9dbd39c2b 100644 --- a/src/actors/scala/actors/AbstractReactor.scala +++ b/src/actors/scala/actors/AbstractReactor.scala @@ -11,7 +11,6 @@ /** * The <code>AbstractReactor</code> trait. * - * @version 0.9.18 * @author Philipp Haller */ package scala.actors diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 838d3a8f63..491c1eb075 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -10,7 +10,7 @@ package scala.actors -import scala.util.control.ControlException +import scala.util.control.ControlThrowable import java.util.{Timer, TimerTask} import java.util.concurrent.{ExecutionException, Callable} @@ -22,14 +22,42 @@ import java.util.concurrent.{ExecutionException, Callable} * * @author Philipp Haller */ -object Actor { +object Actor extends Combinators { + + /** An actor state. An actor can be in one of the following states: + * <ul> + * <li>New<br> + * An actor that has not yet started is in this state.</li> + * <li>Runnable<br> + * An actor executing is in this state.</li> + * <li>Suspended<br> + * An actor that is suspended waiting in a react is in this state.</li> + * <li>TimedSuspended<br> + * An actor that is suspended waiting in a reactWithin is in this state.</li> + * <li>Blocked<br> + * An actor that is blocked waiting in a receive is in this state.</li> + * <li>TimedBlocked<br> + * An actor that is blocked waiting in a receiveWithin is in this state.</li> + * <li>Terminated<br> + * An actor that has terminated is in this state.</li> + * </ul> + */ + object State extends Enumeration { + val New, + Runnable, + Suspended, + TimedSuspended, + Blocked, + TimedBlocked, + Terminated = Value + } - private[actors] val tl = new ThreadLocal[Reactor] + private[actors] val tl = new ThreadLocal[ReplyReactor] // timer thread runs as daemon private[actors] val timer = new Timer(true) - private[actors] val suspendException = new SuspendActorException + private[actors] val suspendException = new SuspendActorControl /** * Returns the currently executing actor. Should be used instead @@ -43,9 +71,10 @@ object Actor { private[actors] def self(sched: IScheduler): Actor = rawSelf(sched).asInstanceOf[Actor] - private[actors] def rawSelf: Reactor = rawSelf(Scheduler) + private[actors] def rawSelf: ReplyReactor = + rawSelf(Scheduler) - private[actors] def rawSelf(sched: IScheduler): Reactor = { + private[actors] def rawSelf(sched: IScheduler): ReplyReactor = { val s = tl.get if (s eq null) { val r = new ActorProxy(currentThread, sched) @@ -208,7 +237,7 @@ object Actor { def eventloop(f: PartialFunction[Any, Unit]): Nothing = rawSelf.react(new RecursiveProxyHandler(rawSelf, f)) - private class RecursiveProxyHandler(a: Reactor, f: PartialFunction[Any, Unit]) + private class RecursiveProxyHandler(a: ReplyReactor, f: PartialFunction[Any, Unit]) extends PartialFunction[Any, Unit] { def isDefinedAt(m: Any): Boolean = true // events are immediately removed from the mailbox @@ -222,21 +251,21 @@ object Actor { * Returns the actor which sent the last received message. */ def sender: OutputChannel[Any] = - rawSelf.asInstanceOf[ReplyReactor].sender + rawSelf.sender /** * Send <code>msg</code> to the actor waiting in a call to * <code>!?</code>. */ def reply(msg: Any): Unit = - rawSelf.asInstanceOf[ReplyReactor].reply(msg) + rawSelf.reply(msg) /** * Send <code>()</code> to the actor waiting in a call to * <code>!?</code>. */ def reply(): Unit = - rawSelf.asInstanceOf[ReplyReactor].reply(()) + rawSelf.reply(()) /** * Returns the number of messages in <code>self</code>'s mailbox @@ -276,26 +305,6 @@ object Actor { } /** - * Causes <code>self</code> to repeatedly execute - * <code>body</code>. - * - * @param body the code block to be executed - */ - def loop(body: => Unit): Unit = body andThen loop(body) - - /** - * Causes <code>self</code> to repeatedly execute - * <code>body</code> while the condition - * <code>cond</code> is <code>true</code>. - * - * @param cond the condition to test - * @param body the code block to be executed - */ - def loopWhile(cond: => Boolean)(body: => Unit): Unit = - if (cond) { body andThen loopWhile(cond)(body) } - else continue - - /** * Links <code>self</code> to actor <code>to</code>. * * @param to the actor to link to @@ -348,9 +357,8 @@ object Actor { * <code>Exit(self, 'normal)</code> to <code>a</code>. * </p> */ - def exit(): Nothing = self.exit() + def exit(): Nothing = rawSelf.exit() - def continue: Unit = throw new KillActorException } /** @@ -376,7 +384,7 @@ object Actor { * @author Philipp Haller */ @serializable @SerialVersionUID(-781154067877019505L) -trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { +trait Actor extends AbstractActor with ReplyReactor with ActorCanReply { /* The following two fields are only used when the actor * suspends by blocking its underlying thread, for example, @@ -392,12 +400,6 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { @volatile private var received: Option[Any] = None - /* This option holds a TimerTask when the actor waits in a - * reactWithin/receiveWithin. The TimerTask is cancelled when - * the actor can continue. - */ - private var onTimeout: Option[TimerTask] = None - protected[actors] override def scheduler: IScheduler = Scheduler private[actors] override def startSearch(msg: Any, replyTo: OutputChannel[Any], handler: PartialFunction[Any, Any]) = @@ -408,19 +410,8 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { } } else super.startSearch(msg, replyTo, handler) - private[actors] override def makeReaction(fun: () => Unit): Runnable = - new ActorTask(this, fun) - - private[actors] override def resumeReceiver(item: (Any, OutputChannel[Any]), handler: PartialFunction[Any, Any], onSameThread: Boolean) { - synchronized { - if (!onTimeout.isEmpty) { - onTimeout.get.cancel() - onTimeout = None - } - } - senders = List(item._2) - super.resumeReceiver(item, handler, onSameThread) - } + private[actors] override def makeReaction(fun: () => Unit, handler: PartialFunction[Any, Any], msg: Any): Runnable = + new ActorTask(this, fun, handler, msg) /** * Receives a message from this actor's mailbox. @@ -551,89 +542,18 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { result } - /** - * Receives a message from this actor's mailbox. - * <p> - * This method never returns. Therefore, the rest of the computation - * has to be contained in the actions of the partial function. - * - * @param f a partial function with message patterns and actions - */ - override def react(f: PartialFunction[Any, Unit]): Nothing = { - assert(Actor.self(scheduler) == this, "react on channel belonging to other actor") + override def react(handler: PartialFunction[Any, Unit]): Nothing = { synchronized { - if (shouldExit) exit() // links - drainSendBuffer(mailbox) + if (shouldExit) exit() } - searchMailbox(mailbox, f, false) - throw Actor.suspendException + super.react(handler) } - /** - * Receives a message from this actor's mailbox within a certain - * time span. - * <p> - * This method never returns. Therefore, the rest of the computation - * has to be contained in the actions of the partial function. - * - * @param msec the time span before timeout - * @param f a partial function with message patterns and actions - */ - def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = { - assert(Actor.self(scheduler) == this, "react on channel belonging to other actor") - + override def reactWithin(msec: Long)(handler: PartialFunction[Any, Unit]): Nothing = { synchronized { - if (shouldExit) exit() // links - drainSendBuffer(mailbox) - } - - // first, remove spurious TIMEOUT message from mailbox if any - mailbox.extractFirst((m: Any, replyTo: OutputChannel[Any]) => m == TIMEOUT) - - val receiveTimeout = () => { - if (f.isDefinedAt(TIMEOUT)) { - senders = List(this) - scheduleActor(f, TIMEOUT) - } else - error("unhandled timeout") + if (shouldExit) exit() } - - var done = false - while (!done) { - val qel = mailbox.extractFirst((m: Any, replyTo: OutputChannel[Any]) => { - senders = List(replyTo) - f.isDefinedAt(m) - }) - if (null eq qel) { - val todo = synchronized { - // in mean time new stuff might have arrived - if (!sendBuffer.isEmpty) { - drainSendBuffer(mailbox) - // keep going - () => {} - } else if (msec == 0L) { - done = true - receiveTimeout - } else { - waitingFor = f - val thisActor = this - onTimeout = Some(new TimerTask { - def run() { thisActor.send(TIMEOUT, thisActor) } - }) - Actor.timer.schedule(onTimeout.get, msec) - done = true - () => {} - } - } - todo() - } else { - senders = List(qel.session) - scheduleActor(f, qel.msg) - done = true - } - } - - throw Actor.suspendException + super.reactWithin(msec)(handler) } /** @@ -644,13 +564,13 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { } // guarded by lock of this - // never throws SuspendActorException + // never throws SuspendActorControl private[actors] override def scheduleActor(f: PartialFunction[Any, Any], msg: Any) = if (f eq null) { // do nothing (timeout is handled instead) } else { - val task = new Reaction(this, f, msg) + val task = new ActorTask(this, null, f, msg) scheduler executeFromActor task } @@ -681,26 +601,44 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { notify() } + private[actors] override def exiting = synchronized { + _state == Actor.State.Terminated + } + /** * Starts this actor. */ override def start(): Actor = synchronized { - // Reset various flags. - // - // Note that we do *not* reset `trapExit`. The reason is that - // users should be able to set the field in the constructor - // and before `act` is called. + if (_state == Actor.State.New) { + _state = Actor.State.Runnable + + // Reset various flags. + // + // Note that we do *not* reset `trapExit`. The reason is that + // users should be able to set the field in the constructor + // and before `act` is called. + exitReason = 'normal + shouldExit = false - exitReason = 'normal - exiting = false - shouldExit = false + scheduler newActor this + scheduler execute (new Reaction(this)) - scheduler.newActor(this) - scheduler.execute(new Reaction(this)) + this + } else + this + } - this + override def getState: Actor.State.Value = synchronized { + if (isSuspended) { + if (onTimeout.isEmpty) + Actor.State.Blocked + else + Actor.State.TimedBlocked + } else + super.getState } + // guarded by this private[actors] var links: List[AbstractActor] = Nil /** @@ -750,8 +688,11 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { links = links.filterNot(from.==) } + @volatile var trapExit = false - private[actors] var exitReason: AnyRef = 'normal + // guarded by this + private var exitReason: AnyRef = 'normal + // guarded by this private[actors] var shouldExit = false /** @@ -771,7 +712,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { * <code>reason != 'normal</code>. * </p> */ - protected[actors] def exit(reason: AnyRef): Nothing = { + protected[actors] def exit(reason: AnyRef): Nothing = synchronized { exitReason = reason exit() } @@ -779,17 +720,16 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { /** * Terminates with exit reason <code>'normal</code>. */ - protected[actors] override def exit(): Nothing = { - // links + protected[actors] override def exit(): Nothing = synchronized { if (!links.isEmpty) exitLinked() - terminated() - throw Actor.suspendException + super.exit() } // Assume !links.isEmpty + // guarded by this private[actors] def exitLinked() { - exiting = true + _state = Actor.State.Terminated // remove this from links val mylinks = links.filterNot(this.==) // exit linked processes @@ -801,6 +741,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { } // Assume !links.isEmpty + // guarded by this private[actors] def exitLinked(reason: AnyRef) { exitReason = reason exitLinked() @@ -820,14 +761,14 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { // (because shouldExit == true) if (isSuspended) resumeActor() - else if (waitingFor ne waitingForNone) { + else if (waitingFor ne Reactor.waitingForNone) { scheduleActor(waitingFor, null) - /* Here we should not throw a SuspendActorException, + /* Here we should not throw a SuspendActorControl, since the current method is called from an actor that is in the process of exiting. Therefore, the contract for scheduleActor is that - it never throws a SuspendActorException. + it never throws a SuspendActorControl. */ } } @@ -857,12 +798,18 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { * <b>case</b> TIMEOUT <b>=></b> ... * }</pre> * - * @version 0.9.8 * @author Philipp Haller */ case object TIMEOUT +/** An `Exit` message (an instance of this class) is sent to an actor + * with `trapExit` set to `true` whenever one of its linked actors + * terminates. + * + * @param from the actor that terminated + * @param reason the reason that caused the actor to terminate + */ case class Exit(from: AbstractActor, reason: AnyRef) /** <p> @@ -870,7 +817,6 @@ case class Exit(from: AbstractActor, reason: AnyRef) * executions. * </p> * - * @version 0.9.8 * @author Philipp Haller */ -private[actors] class SuspendActorException extends Throwable with ControlException +private[actors] class SuspendActorControl extends ControlThrowable diff --git a/src/actors/scala/actors/ReplyableActor.scala b/src/actors/scala/actors/ActorCanReply.scala index 2122dd854b..8cba425b4c 100644 --- a/src/actors/scala/actors/ReplyableActor.scala +++ b/src/actors/scala/actors/ActorCanReply.scala @@ -13,13 +13,12 @@ package scala.actors import java.util.concurrent.ExecutionException /** - * The ReplyableActor trait provides - * message send operations that may result in a - * response from the receiver. + * The ActorCanReply trait provides message send operations that + * may result in a response from the receiver. * * @author Philipp Haller */ -private[actors] trait ReplyableActor extends ReplyableReactor { +private[actors] trait ActorCanReply extends ReactorCanReply { thiz: AbstractActor with ReplyReactor => /** @@ -59,18 +58,18 @@ private[actors] trait ReplyableActor extends ReplyableReactor { * Sends <code>msg</code> to this actor and immediately * returns a future representing the reply value. * The reply is post-processed using the partial function - * <code>f</code>. This also allows to recover a more + * <code>handler</code>. This also allows to recover a more * precise type for the reply value. */ - override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = { + override def !![A](msg: Any, handler: PartialFunction[Any, A]): Future[A] = { val ftch = new Channel[A](Actor.self(thiz.scheduler)) thiz.send(msg, new OutputChannel[Any] { def !(msg: Any) = - ftch ! f(msg) + ftch ! handler(msg) def send(msg: Any, replyTo: OutputChannel[Any]) = - ftch.send(f(msg), replyTo) + ftch.send(handler(msg), replyTo) def forward(msg: Any) = - ftch.forward(f(msg)) + ftch.forward(handler(msg)) def receiver = ftch.receiver }) @@ -84,19 +83,25 @@ private[actors] trait ReplyableActor extends ReplyableReactor { override def !!(msg: Any): Future[Any] = { val ftch = new Channel[Any](Actor.self(thiz.scheduler)) val linkedChannel = new AbstractActor { - type Future[+R] = scala.actors.Future[R] - def !(msg: Any) = + def !(msg: Any) = { ftch ! msg - def send(msg: Any, replyTo: OutputChannel[Any]) = + thiz unlinkFrom this + } + def send(msg: Any, replyTo: OutputChannel[Any]) = { ftch.send(msg, replyTo) - def forward(msg: Any) = + thiz unlinkFrom this + } + def forward(msg: Any) = { ftch.forward(msg) + thiz unlinkFrom this + } def receiver = ftch.receiver def linkTo(to: AbstractActor) { /* do nothing */ } def unlinkFrom(from: AbstractActor) { /* do nothing */ } def exit(from: AbstractActor, reason: AnyRef) { ftch.send(Exit(from, reason), thiz) + thiz unlinkFrom this } // should never be invoked; return dummy value def !?(msg: Any) = msg @@ -113,7 +118,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor { Futures.fromInputChannel(someChan) } } - thiz.linkTo(linkedChannel) + thiz linkTo linkedChannel thiz.send(msg, linkedChannel) new Future[Any](ftch) { var exitReason: Option[Any] = None @@ -135,13 +140,13 @@ private[actors] trait ReplyableActor extends ReplyableReactor { else throw new ExecutionException(new Exception(reason.toString())) } - } else inputChannel.receive(handleReply andThen {(x: Unit) => apply()}) + } else inputChannel.receive(handleReply andThen { _ => apply() }) def respond(k: Any => Unit): Unit = if (isSet) apply() else - inputChannel.react(handleReply andThen {(x: Unit) => k(apply())}) + inputChannel.react(handleReply andThen { _ => k(apply()) }) def isSet = (fvalue match { case None => @@ -150,7 +155,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor { false } val whatToDo = - handleTimeout orElse (handleReply andThen {(x: Unit) => true}) + handleTimeout orElse (handleReply andThen { _ => true }) inputChannel.receiveWithin(0)(whatToDo) case Some(_) => true }) || !exitReason.isEmpty diff --git a/src/actors/scala/actors/ActorProxy.scala b/src/actors/scala/actors/ActorProxy.scala index 6364db87fe..9a79ff14c5 100644 --- a/src/actors/scala/actors/ActorProxy.scala +++ b/src/actors/scala/actors/ActorProxy.scala @@ -16,7 +16,6 @@ import java.lang.Thread * The class <code>ActorProxy</code> provides a dynamic actor proxy for normal * Java threads. * - * @version 0.9.8 * @author Philipp Haller */ private[actors] class ActorProxy(t: Thread, override final val scheduler: IScheduler) extends Actor { diff --git a/src/actors/scala/actors/ActorTask.scala b/src/actors/scala/actors/ActorTask.scala index 8d8504245f..bceea06072 100644 --- a/src/actors/scala/actors/ActorTask.scala +++ b/src/actors/scala/actors/ActorTask.scala @@ -17,14 +17,19 @@ package scala.actors * * @author Philipp Haller */ -private[actors] class ActorTask(actor: Actor, fun: () => Unit) extends ReactorTask[Actor](actor, fun) { +private[actors] class ActorTask(actor: Actor, + fun: () => Unit, + handler: PartialFunction[Any, Any], + msg: Any) + extends ReplyReactorTask(actor, fun, handler, msg) { - protected override def beforeExecuting() { + protected override def beginExecution() { + super.beginExecution() if (actor.shouldExit) actor.exit() } - protected override def afterExecuting(e: Exception) { + protected override def terminateExecution(e: Exception) { actor.synchronized { if (!actor.links.isEmpty) actor.exitLinked(e) diff --git a/src/actors/scala/actors/Replyable.scala b/src/actors/scala/actors/CanReply.scala index 2c7e55e06a..23f0a5319b 100644 --- a/src/actors/scala/actors/Replyable.scala +++ b/src/actors/scala/actors/CanReply.scala @@ -11,16 +11,15 @@ package scala.actors /** - * The Replyable trait defines result-bearing message send operations - * on replyable actors. + * The <code>CanReply</code> trait defines result-bearing message send operations. * * @author Philipp Haller */ -trait Replyable[-T, +R] { +trait CanReply[-T, +R] { /** - * Sends <code>msg</code> to this Replyable and awaits reply - * (synchronous). + * Sends <code>msg</code> to this <code>CanReply</code> and + * awaits reply (synchronous). * * @param msg the message to be sent * @return the reply @@ -28,8 +27,9 @@ trait Replyable[-T, +R] { def !?(msg: T): R /** - * Sends <code>msg</code> to this Replyable and awaits reply - * (synchronous) within <code>msec</code> milliseconds. + * Sends <code>msg</code> to this <code>CanReply</code> and + * awaits reply (synchronous) within <code>msec</code> + * milliseconds. * * @param msec the time span before timeout * @param msg the message to be sent @@ -39,8 +39,8 @@ trait Replyable[-T, +R] { def !?(msec: Long, msg: T): Option[R] /** - * Sends <code>msg</code> to this actor and immediately - * returns a future representing the reply value. + * Sends <code>msg</code> to this <code>CanReply</code> and + * immediately returns a future representing the reply value. * * @param msg the message to be sent * @return the future @@ -49,17 +49,17 @@ trait Replyable[-T, +R] { () => this !? msg /** - * Sends <code>msg</code> to this actor and immediately - * returns a future representing the reply value. + * Sends <code>msg</code> to this <code>CanReply</code> and + * immediately returns a future representing the reply value. * The reply is post-processed using the partial function - * <code>f</code>. This also allows to recover a more + * <code>handler</code>. This also allows to recover a more * precise type for the reply value. * - * @param msg the message to be sent - * @param f the function to be applied to the response - * @return the future + * @param msg the message to be sent + * @param handler the function to be applied to the response + * @return the future */ - def !![P](msg: T, f: PartialFunction[R, P]): () => P = - () => f(this !? msg) + def !![P](msg: T, handler: PartialFunction[R, P]): () => P = + () => handler(this !? msg) } diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala index 24340d22f2..4c37de7665 100644 --- a/src/actors/scala/actors/Channel.scala +++ b/src/actors/scala/actors/Channel.scala @@ -25,7 +25,6 @@ package scala.actors * } * </pre> * - * @version 0.9.8 * @author Philipp Haller */ case class ! [a](ch: Channel[a], msg: a) @@ -35,7 +34,6 @@ case class ! [a](ch: Channel[a], msg: a) * actors. Only the actor creating an instance of a * <code>Channel</code> may receive from it. * - * @version 0.9.17 * @author Philipp Haller */ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputChannel[Msg] { diff --git a/src/actors/scala/actors/Combinators.scala b/src/actors/scala/actors/Combinators.scala new file mode 100644 index 0000000000..3c0be7ed15 --- /dev/null +++ b/src/actors/scala/actors/Combinators.scala @@ -0,0 +1,39 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +package scala.actors + +private[actors] trait Combinators { + + implicit def mkBody[a](body: => a): Actor.Body[a] + + /** + * Causes <code>self</code> to repeatedly execute + * <code>body</code>. + * + * @param body the code block to be executed + */ + def loop(body: => Unit): Unit = body andThen loop(body) + + /** + * Causes <code>self</code> to repeatedly execute + * <code>body</code> while the condition + * <code>cond</code> is <code>true</code>. + * + * @param cond the condition to test + * @param body the code block to be executed + */ + def loopWhile(cond: => Boolean)(body: => Unit): Unit = + if (cond) { body andThen loopWhile(cond)(body) } + else continue + + def continue: Unit = throw new KillActorControl + +} diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index ebb0489d88..9f65786879 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -28,6 +28,9 @@ abstract class Future[+T](val inputChannel: InputChannel[T]) extends Responder[T private[actors] def fvalueTyped = fvalue.get.asInstanceOf[T] @deprecated("this member is going to be removed in a future release") + val ch: InputChannel[Any] = inputChannel + + @deprecated("this member is going to be removed in a future release") protected def value: Option[Any] = fvalue @deprecated("this member is going to be removed in a future release") protected def value_=(x: Option[Any]) { fvalue = x } @@ -46,11 +49,15 @@ abstract class Future[+T](val inputChannel: InputChannel[T]) extends Responder[T */ object Futures { + import scala.concurrent.SyncVar + private case object Eval - private class FutureActor[T](fun: () => T, channel: Channel[T]) + private class FutureActor[T](fun: SyncVar[T] => Unit, channel: Channel[T]) extends Future[T](channel) with DaemonActor { + import Actor._ + def isSet = !fvalue.isEmpty def apply(): T = { @@ -70,12 +77,17 @@ object Futures { } def act() { - val res = fun() - fvalue = Some(res) - channel ! res - Actor.loop { - Actor.react { - case Eval => Actor.reply() + val res = new SyncVar[T] + + { + fun(res) + } andThen { + fvalue = Some(res.get) + channel ! res.get + loop { + react { + case Eval => reply() + } } } } @@ -90,7 +102,7 @@ object Futures { */ def future[T](body: => T): Future[T] = { val c = new Channel[T](Actor.self(DaemonScheduler)) - val a = new FutureActor[T](() => body, c) + val a = new FutureActor[T](_.set(body), c) a.start() a } @@ -100,10 +112,16 @@ object Futures { * @param timespan the time span in ms after which the future resolves * @return the future */ - def alarm(timespan: Long) = future { - Actor.reactWithin(timespan) { - case TIMEOUT => {} + def alarm(timespan: Long): Future[Unit] = { + val c = new Channel[Unit](Actor.self(DaemonScheduler)) + val fun = (res: SyncVar[Unit]) => { + Actor.reactWithin(timespan) { + case TIMEOUT => res.set({}) + } } + val a = new FutureActor[Unit](fun, c) + a.start() + a } /** Waits for the first result returned by one of two diff --git a/src/actors/scala/actors/IScheduler.scala b/src/actors/scala/actors/IScheduler.scala index 7a47c670e7..1718dab045 100644 --- a/src/actors/scala/actors/IScheduler.scala +++ b/src/actors/scala/actors/IScheduler.scala @@ -49,14 +49,14 @@ trait IScheduler { * * @param a the actor to be registered */ - def newActor(a: Reactor): Unit + def newActor(a: TrackedReactor): Unit /** Unregisters an actor from this scheduler, because it * has terminated. * * @param a the actor to be registered */ - def terminated(a: Reactor): Unit + def terminated(a: TrackedReactor): Unit /** Registers a closure to be executed when the specified * actor terminates. @@ -64,7 +64,7 @@ trait IScheduler { * @param a the actor * @param f the closure to be registered */ - def onTerminate(a: Reactor)(f: => Unit): Unit + def onTerminate(a: TrackedReactor)(f: => Unit): Unit def managedBlock(blocker: scala.concurrent.ManagedBlocker): Unit diff --git a/src/actors/scala/actors/InputChannel.scala b/src/actors/scala/actors/InputChannel.scala index 46988159fa..fa2fad43c6 100644 --- a/src/actors/scala/actors/InputChannel.scala +++ b/src/actors/scala/actors/InputChannel.scala @@ -14,7 +14,6 @@ package scala.actors * The <code>InputChannel</code> trait provides a common interface * for all channels from which values can be received. * - * @version 0.9.8 * @author Philipp Haller */ trait InputChannel[+Msg] { diff --git a/src/actors/scala/actors/MessageQueue.scala b/src/actors/scala/actors/MessageQueue.scala index 000ff1bfc6..2c1c2446e6 100644 --- a/src/actors/scala/actors/MessageQueue.scala +++ b/src/actors/scala/actors/MessageQueue.scala @@ -18,14 +18,14 @@ package scala.actors */ @serializable @SerialVersionUID(7124278808020037465L) @deprecated("this class is going to be removed in a future release") -class MessageQueueElement(msg: Any, session: OutputChannel[Any], next: MessageQueueElement) extends MQueueElement(msg, session, next) { +class MessageQueueElement(msg: Any, session: OutputChannel[Any], next: MessageQueueElement) extends MQueueElement[Any](msg, session, next) { def this() = this(null, null, null) def this(msg: Any, session: OutputChannel[Any]) = this(msg, session, null) } -private[actors] class MQueueElement(val msg: Any, val session: OutputChannel[Any], var next: MQueueElement) { +private[actors] class MQueueElement[Msg >: Null](val msg: Msg, val session: OutputChannel[Any], var next: MQueueElement[Msg]) { def this() = this(null, null, null) - def this(msg: Any, session: OutputChannel[Any]) = this(msg, session, null) + def this(msg: Msg, session: OutputChannel[Any]) = this(msg, session, null) } /** @@ -38,11 +38,11 @@ private[actors] class MQueueElement(val msg: Any, val session: OutputChannel[Any */ @serializable @SerialVersionUID(2168935872884095767L) @deprecated("this class is going to be removed in a future release") -class MessageQueue(label: String) extends MQueue(label) +class MessageQueue(label: String) extends MQueue[Any](label) -private[actors] class MQueue(protected val label: String) { - protected var first: MQueueElement = null - protected var last: MQueueElement = null // last eq null iff list is empty +private[actors] class MQueue[Msg >: Null](protected val label: String) { + protected var first: MQueueElement[Msg] = null + protected var last: MQueueElement[Msg] = null // last eq null iff list is empty private var _size = 0 def size = _size @@ -52,7 +52,7 @@ private[actors] class MQueue(protected val label: String) { _size += diff } - def append(msg: Any, session: OutputChannel[Any]) { + def append(msg: Msg, session: OutputChannel[Any]) { changeSize(1) // size always increases by 1 val el = new MQueueElement(msg, session) @@ -62,7 +62,7 @@ private[actors] class MQueue(protected val label: String) { last = el } - def append(el: MQueueElement) { + def append(el: MQueueElement[Msg]) { changeSize(1) // size always increases by 1 if (isEmpty) first = el @@ -71,7 +71,7 @@ private[actors] class MQueue(protected val label: String) { last = el } - def foreach(f: (Any, OutputChannel[Any]) => Unit) { + def foreach(f: (Msg, OutputChannel[Any]) => Unit) { var curr = first while (curr != null) { f(curr.msg, curr.session) @@ -79,7 +79,7 @@ private[actors] class MQueue(protected val label: String) { } } - def foreachAppend(target: MQueue) { + def foreachAppend(target: MQueue[Msg]) { var curr = first while (curr != null) { target.append(curr) @@ -87,7 +87,7 @@ private[actors] class MQueue(protected val label: String) { } } - def foreachDequeue(target: MQueue) { + def foreachDequeue(target: MQueue[Msg]) { var curr = first while (curr != null) { target.append(curr) @@ -98,7 +98,7 @@ private[actors] class MQueue(protected val label: String) { _size = 0 } - def foldLeft[B](z: B)(f: (B, Any) => B): B = { + def foldLeft[B](z: B)(f: (B, Msg) => B): B = { var acc = z var curr = first while (curr != null) { @@ -111,10 +111,10 @@ private[actors] class MQueue(protected val label: String) { /** Returns the n-th message that satisfies the predicate <code>p</code> * without removing it. */ - def get(n: Int)(p: Any => Boolean): Option[Any] = { + def get(n: Int)(p: Msg => Boolean): Option[Msg] = { var pos = 0 - def test(msg: Any): Boolean = + def test(msg: Msg): Boolean = p(msg) && (pos == n || { pos += 1; false }) var curr = first @@ -127,16 +127,16 @@ private[actors] class MQueue(protected val label: String) { /** Removes the n-th message that satisfies the predicate <code>p</code>. */ - def remove(n: Int)(p: (Any, OutputChannel[Any]) => Boolean): Option[(Any, OutputChannel[Any])] = + def remove(n: Int)(p: (Msg, OutputChannel[Any]) => Boolean): Option[(Msg, OutputChannel[Any])] = removeInternal(n)(p) map (x => (x.msg, x.session)) /** Extracts the first message that satisfies the predicate <code>p</code> * or <code>null</code> if <code>p</code> fails for all of them. */ - def extractFirst(p: (Any, OutputChannel[Any]) => Boolean): MQueueElement = + def extractFirst(p: (Msg, OutputChannel[Any]) => Boolean): MQueueElement[Msg] = removeInternal(0)(p) orNull - def extractFirst(pf: PartialFunction[Any, Any]): MQueueElement = { + def extractFirst(pf: PartialFunction[Msg, Any]): MQueueElement[Msg] = { if (isEmpty) // early return return null @@ -173,14 +173,14 @@ private[actors] class MQueue(protected val label: String) { } } - private def removeInternal(n: Int)(p: (Any, OutputChannel[Any]) => Boolean): Option[MQueueElement] = { + private def removeInternal(n: Int)(p: (Msg, OutputChannel[Any]) => Boolean): Option[MQueueElement[Msg]] = { var pos = 0 - def foundMsg(x: MQueueElement) = { + def foundMsg(x: MQueueElement[Msg]) = { changeSize(-1) Some(x) } - def test(msg: Any, session: OutputChannel[Any]): Boolean = + def test(msg: Msg, session: OutputChannel[Any]): Boolean = p(msg, session) && (pos == n || { pos += 1 ; false }) if (isEmpty) // early return @@ -220,7 +220,7 @@ private[actors] class MQueue(protected val label: String) { /** Debugging trait. */ -private[actors] trait MessageQueueTracer extends MQueue +private[actors] trait MessageQueueTracer extends MQueue[Any] { private val queueNumber = MessageQueueTracer.getQueueNumber @@ -238,7 +238,7 @@ private[actors] trait MessageQueueTracer extends MQueue printQueue("REMOVE %s" format res) res } - override def extractFirst(p: (Any, OutputChannel[Any]) => Boolean): MQueueElement = { + override def extractFirst(p: (Any, OutputChannel[Any]) => Boolean): MQueueElement[Any] = { val res = super.extractFirst(p) printQueue("EXTRACT_FIRST %s" format res) res @@ -253,7 +253,7 @@ private[actors] trait MessageQueueTracer extends MQueue override def toString() = "%s:%d".format(label, queueNumber) } -object MessageQueueTracer { +private[actors] object MessageQueueTracer { // for tracing purposes private var queueNumberAssigner = 0 private def getQueueNumber = synchronized { diff --git a/src/actors/scala/actors/OutputChannel.scala b/src/actors/scala/actors/OutputChannel.scala index 4fdd606a40..514c445944 100644 --- a/src/actors/scala/actors/OutputChannel.scala +++ b/src/actors/scala/actors/OutputChannel.scala @@ -14,7 +14,6 @@ package scala.actors * The <code>OutputChannel</code> trait provides a common interface * for all channels to which values can be sent. * - * @version 0.9.17 * @author Philipp Haller */ trait OutputChannel[-Msg] extends AbstractReactor[Msg] { @@ -42,7 +41,7 @@ trait OutputChannel[-Msg] extends AbstractReactor[Msg] { def forward(msg: Msg): Unit /** - * Returns the <code>Reactor</code> that is + * Returns the <code>Actor</code> that is * receiving from this <code>OutputChannel</code>. */ def receiver: Actor diff --git a/src/actors/scala/actors/ReactChannel.scala b/src/actors/scala/actors/ReactChannel.scala index 8bbbc04f53..dc31e99711 100644 --- a/src/actors/scala/actors/ReactChannel.scala +++ b/src/actors/scala/actors/ReactChannel.scala @@ -15,7 +15,7 @@ package scala.actors * * @author Philipp Haller */ -private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[Msg] { +private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputChannel[Msg] { private case class SendToReactor(channel: ReactChannel[Msg], msg: Msg) diff --git a/src/actors/scala/actors/Reaction.scala b/src/actors/scala/actors/Reaction.scala index 753dd7da83..5a6d9b643c 100644 --- a/src/actors/scala/actors/Reaction.scala +++ b/src/actors/scala/actors/Reaction.scala @@ -11,10 +11,10 @@ package scala.actors -import scala.util.control.ControlException +import scala.util.control.ControlThrowable import java.lang.{InterruptedException, Runnable} -private[actors] class KillActorException extends Throwable with ControlException +private[actors] class KillActorControl extends ControlThrowable /** <p> * The abstract class <code>Reaction</code> associates @@ -23,15 +23,11 @@ private[actors] class KillActorException extends Throwable with ControlException * <code>java.lang.Runnable</code></a>. * </p> * - * @deprecated("this class is going to be removed in a future release") * @author Philipp Haller */ -class Reaction(a: Actor, f: PartialFunction[Any, Any], msg: Any) extends ActorTask(a, () => { - if (f == null) - a.act() - else - f(msg) -}) { +@deprecated("This class will be removed in a future release") +class Reaction(a: Actor, f: PartialFunction[Any, Any], msg: Any) +extends ActorTask(a, if (f == null) (() => a.act()) else null, f, msg) { def this(a: Actor) = this(a, null, null) diff --git a/src/actors/scala/actors/Reactor.scala b/src/actors/scala/actors/Reactor.scala index eb0485263b..db43921056 100644 --- a/src/actors/scala/actors/Reactor.scala +++ b/src/actors/scala/actors/Reactor.scala @@ -10,18 +10,40 @@ package scala.actors -import scala.actors.scheduler.{DelegatingScheduler, DefaultThreadPoolScheduler} -import scala.collection.mutable.Queue +import scala.actors.scheduler.{DelegatingScheduler, ExecutorScheduler, + ForkJoinScheduler, ThreadPoolConfig} +import java.util.concurrent.{ThreadPoolExecutor, TimeUnit, LinkedBlockingQueue} + +private[actors] object Reactor { -private object Reactor { val scheduler = new DelegatingScheduler { def makeNewScheduler: IScheduler = { - val s = new DefaultThreadPoolScheduler(false) - Debug.info(this+": starting new "+s+" ["+s.getClass+"]") - s.start() - s + val sched = if (!ThreadPoolConfig.useForkJoin) { + // default is non-daemon + val workQueue = new LinkedBlockingQueue[Runnable] + ExecutorScheduler( + new ThreadPoolExecutor(ThreadPoolConfig.corePoolSize, + ThreadPoolConfig.maxPoolSize, + 60000L, + TimeUnit.MILLISECONDS, + workQueue, + new ThreadPoolExecutor.CallerRunsPolicy)) + } else { + // default is non-daemon, non-fair + val s = new ForkJoinScheduler(ThreadPoolConfig.corePoolSize, ThreadPoolConfig.maxPoolSize, false, false) + s.start() + s + } + Debug.info(this+": starting new "+sched+" ["+sched.getClass+"]") + sched } } + + val waitingForNone = new PartialFunction[Any, Unit] { + def isDefinedAt(x: Any) = false + def apply(x: Any) {} + } + } /** @@ -29,34 +51,35 @@ private object Reactor { * * @author Philipp Haller */ -trait Reactor extends OutputChannel[Any] { +trait Reactor[Msg >: Null] extends OutputChannel[Msg] with Combinators { /* The actor's mailbox. */ - private[actors] val mailbox = new MQueue("Reactor") + private[actors] val mailbox = new MQueue[Msg]("Reactor") // guarded by this - private[actors] val sendBuffer = new MQueue("SendBuffer") + private[actors] val sendBuffer = new MQueue[Msg]("SendBuffer") - /* Whenever this actor executes on some thread, waitingFor is - * guaranteed to be equal to waitingForNone. + /* Whenever this actor executes on some thread, `waitingFor` is + * guaranteed to be equal to `Reactor.waitingForNone`. * - * In other words, whenever waitingFor is not equal to - * waitingForNone, this actor is guaranteed not to execute on some - * thread. + * In other words, whenever `waitingFor` is not equal to + * `Reactor.waitingForNone`, this actor is guaranteed not to execute + * on some thread. + * + * If the actor waits in a `react`, `waitingFor` holds the + * message handler that `react` was called with. + * + * guarded by this */ - private[actors] val waitingForNone = new PartialFunction[Any, Unit] { - def isDefinedAt(x: Any) = false - def apply(x: Any) {} - } + private[actors] var waitingFor: PartialFunction[Msg, Any] = + Reactor.waitingForNone - /* If the actor waits in a react, waitingFor holds the - * message handler that react was called with. - */ - private[actors] var waitingFor: PartialFunction[Any, Any] = waitingForNone // guarded by lock of this + // guarded by this + private[actors] var _state: Actor.State.Value = Actor.State.New /** - * The behavior of an actor is specified by implementing this - * abstract method. + * The behavior of a <code>Reactor</code> is specified by implementing + * this method. */ def act(): Unit @@ -76,11 +99,11 @@ trait Reactor extends OutputChannel[Any] { * @param msg the message to send * @param replyTo the reply destination */ - def send(msg: Any, replyTo: OutputChannel[Any]) { + def send(msg: Msg, replyTo: OutputChannel[Any]) { val todo = synchronized { - if (waitingFor ne waitingForNone) { + if (waitingFor ne Reactor.waitingForNone) { val savedWaitingFor = waitingFor - waitingFor = waitingForNone + waitingFor = Reactor.waitingForNone startSearch(msg, replyTo, savedWaitingFor) } else { sendBuffer.append(msg, replyTo) @@ -90,49 +113,53 @@ trait Reactor extends OutputChannel[Any] { todo() } - private[actors] def startSearch(msg: Any, replyTo: OutputChannel[Any], handler: PartialFunction[Any, Any]) = - () => scheduler execute (makeReaction(() => { - val startMbox = new MQueue("Start") + private[actors] def startSearch(msg: Msg, replyTo: OutputChannel[Any], handler: PartialFunction[Msg, Any]) = + () => scheduler execute makeReaction(() => { + val startMbox = new MQueue[Msg]("Start") synchronized { startMbox.append(msg, replyTo) } searchMailbox(startMbox, handler, true) - })) + }) - private[actors] def makeReaction(fun: () => Unit): Runnable = - new ReactorTask(this, fun) + private[actors] final def makeReaction(fun: () => Unit): Runnable = + makeReaction(fun, null, null) - private[actors] def resumeReceiver(item: (Any, OutputChannel[Any]), handler: PartialFunction[Any, Any], onSameThread: Boolean) { + /* This method is supposed to be overridden. */ + private[actors] def makeReaction(fun: () => Unit, handler: PartialFunction[Msg, Any], msg: Msg): Runnable = + new ReactorTask(this, fun, handler, msg) + + private[actors] def resumeReceiver(item: (Msg, OutputChannel[Any]), handler: PartialFunction[Msg, Any], onSameThread: Boolean) { if (onSameThread) - handler(item._1) - else { + makeReaction(null, handler, item._1).run() + else scheduleActor(handler, item._1) - /* Here, we throw a SuspendActorException to avoid - terminating this actor when the current ReactorTask - is finished. - The SuspendActorException skips the termination code - in ReactorTask. - */ - throw Actor.suspendException - } + /* Here, we throw a SuspendActorControl to avoid + terminating this actor when the current ReactorTask + is finished. + + The SuspendActorControl skips the termination code + in ReactorTask. + */ + throw Actor.suspendException } - def !(msg: Any) { + def !(msg: Msg) { send(msg, null) } - def forward(msg: Any) { + def forward(msg: Msg) { send(msg, null) } def receiver: Actor = this.asInstanceOf[Actor] // guarded by this - private[actors] def drainSendBuffer(mbox: MQueue) { + private[actors] def drainSendBuffer(mbox: MQueue[Msg]) { sendBuffer.foreachDequeue(mbox) } - private[actors] def searchMailbox(startMbox: MQueue, - handler: PartialFunction[Any, Any], + private[actors] def searchMailbox(startMbox: MQueue[Msg], + handler: PartialFunction[Msg, Any], resumeOnSameThread: Boolean) { var tmpMbox = startMbox var done = false @@ -144,16 +171,16 @@ trait Reactor extends OutputChannel[Any] { synchronized { // in mean time new stuff might have arrived if (!sendBuffer.isEmpty) { - tmpMbox = new MQueue("Temp") + tmpMbox = new MQueue[Msg]("Temp") drainSendBuffer(tmpMbox) // keep going } else { waitingFor = handler - /* Here, we throw a SuspendActorException to avoid + /* Here, we throw a SuspendActorControl to avoid terminating this actor when the current ReactorTask is finished. - The SuspendActorException skips the termination code + The SuspendActorControl skips the termination code in ReactorTask. */ throw Actor.suspendException @@ -166,10 +193,17 @@ trait Reactor extends OutputChannel[Any] { } } - protected[actors] def react(f: PartialFunction[Any, Unit]): Nothing = { - assert(Actor.rawSelf(scheduler) == this, "react on channel belonging to other actor") + /** + * Receives a message from this actor's mailbox. + * <p> + * This method never returns. Therefore, the rest of the computation + * has to be contained in the actions of the partial function. + * + * @param handler a partial function with message patterns and actions + */ + protected[actors] def react(handler: PartialFunction[Msg, Unit]): Nothing = { synchronized { drainSendBuffer(mailbox) } - searchMailbox(mailbox, f, false) + searchMailbox(mailbox, handler, false) throw Actor.suspendException } @@ -178,51 +212,71 @@ trait Reactor extends OutputChannel[Any] { * * assume handler != null * - * never throws SuspendActorException + * never throws SuspendActorControl */ - private[actors] def scheduleActor(handler: PartialFunction[Any, Any], msg: Any) = { - val fun = () => handler(msg) - val task = new ReactorTask(this, fun) - scheduler executeFromActor task + private[actors] def scheduleActor(handler: PartialFunction[Msg, Any], msg: Msg) { + scheduler executeFromActor makeReaction(null, handler, msg) } - def start(): Reactor = { - scheduler.newActor(this) - val task = new ReactorTask(this, () => act()) - scheduler execute task - this + def start(): Reactor[Msg] = synchronized { + if (_state == Actor.State.New) { + _state = Actor.State.Runnable + scheduler newActor this + scheduler execute makeReaction(() => act()) + this + } else + this + } + + /** Returns the execution state of this actor. + * + * @return the execution state + */ + def getState: Actor.State.Value = synchronized { + if (waitingFor ne Reactor.waitingForNone) + Actor.State.Suspended + else + _state + } + + implicit def mkBody[A](body: => A) = new Actor.Body[A] { + def andThen[B](other: => B): Unit = Reactor.this.seq(body, other) } /* This closure is used to implement control-flow operations * built on top of `seq`. Note that the only invocation of - * `kill` is supposed to be inside `Reaction.run`. + * `kill` is supposed to be inside `ReactorTask.run`. */ @volatile private[actors] var kill: () => Unit = () => { exit() } private[actors] def seq[a, b](first: => a, next: => b): Unit = { - val s = Actor.rawSelf(scheduler) - val killNext = s.kill - s.kill = () => { - s.kill = killNext + val killNext = this.kill + this.kill = () => { + this.kill = killNext // to avoid stack overflow: // instead of directly executing `next`, // schedule as continuation - scheduleActor({ case _ => next }, 1) + scheduleActor({ case _ => next }, null) throw Actor.suspendException } first - throw new KillActorException + throw new KillActorControl } - protected[this] def exit(): Nothing = { + protected[actors] def exit(): Nothing = { terminated() throw Actor.suspendException } private[actors] def terminated() { + synchronized { + _state = Actor.State.Terminated + // reset waitingFor, otherwise getState returns Suspended + waitingFor = Reactor.waitingForNone + } scheduler.terminated(this) } diff --git a/src/actors/scala/actors/ReplyableReactor.scala b/src/actors/scala/actors/ReactorCanReply.scala index ecca50e26d..c53e3a78e1 100644 --- a/src/actors/scala/actors/ReplyableReactor.scala +++ b/src/actors/scala/actors/ReactorCanReply.scala @@ -11,13 +11,12 @@ package scala.actors /** - * The ReplyableReactor trait provides - * message send operations that may result in a - * response from the receiver. + * The ReactorCanReply trait provides message send operations that + * may result in a response from the receiver. * * @author Philipp Haller */ -private[actors] trait ReplyableReactor extends Replyable[Any, Any] { +private[actors] trait ReactorCanReply extends CanReply[Any, Any] { _: ReplyReactor => /** @@ -67,27 +66,27 @@ private[actors] trait ReplyableReactor extends Replyable[Any, Any] { * Sends <code>msg</code> to this actor and immediately * returns a future representing the reply value. * The reply is post-processed using the partial function - * <code>f</code>. This also allows to recover a more + * <code>handler</code>. This also allows to recover a more * precise type for the reply value. */ - override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = { + override def !![A](msg: Any, handler: PartialFunction[Any, A]): Future[A] = { val myself = Actor.rawSelf(this.scheduler) val ftch = new ReactChannel[A](myself) val res = new scala.concurrent.SyncVar[A] val out = new OutputChannel[Any] { def !(msg: Any) = { - val msg1 = f(msg) + val msg1 = handler(msg) ftch ! msg1 res set msg1 } def send(msg: Any, replyTo: OutputChannel[Any]) = { - val msg1 = f(msg) + val msg1 = handler(msg) ftch.send(msg1, replyTo) res set msg1 } def forward(msg: Any) = { - val msg1 = f(msg) + val msg1 = handler(msg) ftch forward msg1 res set msg1 } diff --git a/src/actors/scala/actors/ReactorTask.scala b/src/actors/scala/actors/ReactorTask.scala index 37aec0f8ec..ac809f04ff 100644 --- a/src/actors/scala/actors/ReactorTask.scala +++ b/src/actors/scala/actors/ReactorTask.scala @@ -8,58 +8,74 @@ // $Id$ - package scala.actors import java.lang.Runnable import java.util.concurrent.Callable +import scala.concurrent.forkjoin.RecursiveAction + /** <p> * The class <code>ReactorTask</code>. * </p> * * @author Philipp Haller */ -private[actors] class ReactorTask[T >: Null <: Reactor](var reactor: T, var fun: () => Any) - extends Callable[Unit] with Runnable { +private[actors] class ReactorTask[Msg >: Null](var reactor: Reactor[Msg], + var fun: () => Any, + var handler: PartialFunction[Msg, Any], + var msg: Msg) + extends RecursiveAction with Callable[Unit] with Runnable { def run() { - val saved = Actor.tl.get - Actor.tl set reactor try { - beforeExecuting() + beginExecution() try { try { - fun() + if (fun eq null) + handler(msg) + else + fun() } catch { case e: Exception if (reactor.exceptionHandler.isDefinedAt(e)) => reactor.exceptionHandler(e) } } catch { - case _: KillActorException => + case _: KillActorControl => } reactor.kill() } catch { - case _: SuspendActorException => + case _: SuspendActorControl => // do nothing (continuation is already saved) case e: Exception => - Debug.info(reactor+": caught "+e) - Debug.doInfo { e.printStackTrace() } + // print message on default error stream + val msgException = "Uncaught exception in "+reactor+"\n" + val msgMessage = if (msg != null) "Message: "+msg+"\n" else "" + Console.err.print(msgException + msgMessage) + e.printStackTrace() + + val uncaught = new UncaughtException(reactor, if (msg != null) Some(msg) else None, currentThread, e) reactor.terminated() - afterExecuting(e) + terminateExecution(uncaught) } finally { - Actor.tl set saved + suspendExecution() this.reactor = null this.fun = null + this.handler = null + this.msg = null } } def call() = run() - protected def beforeExecuting() {} + def compute() = run() + + protected def beginExecution() {} + + protected def suspendExecution() {} - protected def afterExecuting(e: Exception) {} + protected def terminateExecution(e: Exception) {} } diff --git a/src/actors/scala/actors/ReplyReactor.scala b/src/actors/scala/actors/ReplyReactor.scala index d5936ae662..26057ab9cb 100644 --- a/src/actors/scala/actors/ReplyReactor.scala +++ b/src/actors/scala/actors/ReplyReactor.scala @@ -10,6 +10,8 @@ package scala.actors +import java.util.{Timer, TimerTask} + /** <p> * The <code>ReplyReactor</code> trait extends the <code>Reactor</code> * trait with methods to reply to the sender of a message. @@ -19,17 +21,26 @@ package scala.actors * * @author Philipp Haller */ -trait ReplyReactor extends Reactor with ReplyableReactor { +trait ReplyReactor extends Reactor[Any] with ReactorCanReply { /* A list of the current senders. The head of the list is * the sender of the message that was received last. */ @volatile - private[actors] var senders: List[OutputChannel[Any]] = - Nil + private[actors] var senders: List[OutputChannel[Any]] = List() + + /* This option holds a TimerTask when the actor waits in a + * reactWithin. The TimerTask is cancelled when the actor + * resumes. + * + * guarded by this + */ + private[actors] var onTimeout: Option[TimerTask] = None - protected[actors] def sender: OutputChannel[Any] = - senders.head + /** + * Returns the actor which sent the last received message. + */ + protected[actors] def sender: OutputChannel[Any] = senders.head /** * Replies with <code>msg</code> to the sender. @@ -53,17 +64,17 @@ trait ReplyReactor extends Reactor with ReplyableReactor { } private[actors] override def resumeReceiver(item: (Any, OutputChannel[Any]), handler: PartialFunction[Any, Any], onSameThread: Boolean) { - senders = List(item._2) - if (onSameThread) - handler(item._1) - else { - scheduleActor(handler, item._1) - // see Reactor.resumeReceiver - throw Actor.suspendException + synchronized { + if (!onTimeout.isEmpty) { + onTimeout.get.cancel() + onTimeout = None + } } + senders = List(item._2) + super.resumeReceiver(item, handler, onSameThread) } - private[actors] override def searchMailbox(startMbox: MQueue, + private[actors] override def searchMailbox(startMbox: MQueue[Any], handler: PartialFunction[Any, Any], resumeOnSameThread: Boolean) { var tmpMbox = startMbox @@ -79,7 +90,7 @@ trait ReplyReactor extends Reactor with ReplyableReactor { synchronized { // in mean time new stuff might have arrived if (!sendBuffer.isEmpty) { - tmpMbox = new MQueue("Temp") + tmpMbox = new MQueue[Any]("Temp") drainSendBuffer(tmpMbox) // keep going } else { @@ -95,4 +106,70 @@ trait ReplyReactor extends Reactor with ReplyableReactor { } } + private[actors] override def makeReaction(fun: () => Unit, handler: PartialFunction[Any, Any], msg: Any): Runnable = + new ReplyReactorTask(this, fun, handler, msg) + + protected[actors] override def react(handler: PartialFunction[Any, Unit]): Nothing = { + assert(Actor.rawSelf(scheduler) == this, "react on channel belonging to other actor") + super.react(handler) + } + + /** + * Receives a message from this actor's mailbox within a certain + * time span. + * <p> + * This method never returns. Therefore, the rest of the computation + * has to be contained in the actions of the partial function. + * + * @param msec the time span before timeout + * @param handler a partial function with message patterns and actions + */ + protected[actors] def reactWithin(msec: Long)(handler: PartialFunction[Any, Unit]): Nothing = { + assert(Actor.rawSelf(scheduler) == this, "react on channel belonging to other actor") + + synchronized { drainSendBuffer(mailbox) } + + // first, remove spurious TIMEOUT message from mailbox if any + mailbox.extractFirst((m: Any, replyTo: OutputChannel[Any]) => m == TIMEOUT) + + while (true) { + val qel = mailbox.extractFirst((m: Any, replyTo: OutputChannel[Any]) => { + senders = List(replyTo) + handler isDefinedAt m + }) + if (null eq qel) { + synchronized { + // in mean time new messages might have arrived + if (!sendBuffer.isEmpty) { + drainSendBuffer(mailbox) + // keep going + } else if (msec == 0L) { + // throws Actor.suspendException + resumeReceiver((TIMEOUT, this), handler, false) + } else { + waitingFor = handler + val thisActor = this + onTimeout = Some(new TimerTask { + def run() { thisActor.send(TIMEOUT, thisActor) } + }) + Actor.timer.schedule(onTimeout.get, msec) + throw Actor.suspendException + } + } + } else + resumeReceiver((qel.msg, qel.session), handler, false) + } + throw Actor.suspendException + } + + override def getState: Actor.State.Value = synchronized { + if (waitingFor ne Reactor.waitingForNone) { + if (onTimeout.isEmpty) + Actor.State.Suspended + else + Actor.State.TimedSuspended + } else + _state + } + } diff --git a/src/actors/scala/actors/ReplyReactorTask.scala b/src/actors/scala/actors/ReplyReactorTask.scala new file mode 100644 index 0000000000..59150276c0 --- /dev/null +++ b/src/actors/scala/actors/ReplyReactorTask.scala @@ -0,0 +1,36 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +package scala.actors + +/** <p> + * The class <code>ReplyReactorTask</code>. + * </p> + * + * @author Philipp Haller + */ +private[actors] class ReplyReactorTask(reactor: ReplyReactor, + fun: () => Unit, + handler: PartialFunction[Any, Any], + msg: Any) + extends ReactorTask(reactor, fun, handler, msg) { + + var saved: ReplyReactor = _ + + protected override def beginExecution() { + saved = Actor.tl.get + Actor.tl set reactor + } + + protected override def suspendExecution() { + Actor.tl set saved + } + +} diff --git a/src/actors/scala/actors/Scheduler.scala b/src/actors/scala/actors/Scheduler.scala index d653271c1e..6792b65abe 100644 --- a/src/actors/scala/actors/Scheduler.scala +++ b/src/actors/scala/actors/Scheduler.scala @@ -25,10 +25,12 @@ object Scheduler extends DelegatingScheduler { def makeNewScheduler: IScheduler = { val sched = if (!ThreadPoolConfig.useForkJoin) { + // default is non-daemon val s = new ResizableThreadPoolScheduler(false) s.start() s } else { + // default is non-daemon, fair val s = new ForkJoinScheduler s.start() s diff --git a/src/actors/scala/actors/SchedulerAdapter.scala b/src/actors/scala/actors/SchedulerAdapter.scala index f88d15bb38..698096c556 100644 --- a/src/actors/scala/actors/SchedulerAdapter.scala +++ b/src/actors/scala/actors/SchedulerAdapter.scala @@ -42,7 +42,7 @@ trait SchedulerAdapter extends IScheduler { * * @param a the actor to be registered */ - def newActor(a: Reactor) = + def newActor(a: TrackedReactor) = Scheduler.newActor(a) /** Unregisters an actor from this scheduler, because it @@ -50,7 +50,7 @@ trait SchedulerAdapter extends IScheduler { * * @param a the actor to be unregistered */ - def terminated(a: Reactor) = + def terminated(a: TrackedReactor) = Scheduler.terminated(a) /** Registers a closure to be executed when the specified @@ -59,7 +59,7 @@ trait SchedulerAdapter extends IScheduler { * @param a the actor * @param f the closure to be registered */ - def onTerminate(a: Reactor)(f: => Unit) = + def onTerminate(a: TrackedReactor)(f: => Unit) = Scheduler.onTerminate(a)(f) def managedBlock(blocker: scala.concurrent.ManagedBlocker) { diff --git a/src/actors/scala/actors/UncaughtException.scala b/src/actors/scala/actors/UncaughtException.scala new file mode 100644 index 0000000000..30043465a1 --- /dev/null +++ b/src/actors/scala/actors/UncaughtException.scala @@ -0,0 +1,31 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +package scala.actors + +/** + * The exit reason when an actor fails to catch an exception. + * + * @param actor the actor that threw the exception + * @param message the message the actor was processing, or None if no message (e.g. on initial startup) + * @param thread the thread on which the actor was running + * @param cause the uncaught exception + * + * @author Philipp Haller + * @author Erik Engbrecht + */ +class UncaughtException[Msg >: Null](val actor: Reactor[Msg], + val message: Option[Msg], + val thread: Thread, + cause: Exception) +extends Exception(cause) { + + override def toString() = + "UncaughtException("+actor+","+message+","+cause+")" + +} diff --git a/src/actors/scala/actors/package.scala b/src/actors/scala/actors/package.scala index 7075518931..98170b83dd 100644 --- a/src/actors/scala/actors/package.scala +++ b/src/actors/scala/actors/package.scala @@ -1,6 +1,10 @@ package scala package object actors { + + // type of Reactors tracked by termination detector + private[actors] type TrackedReactor = Reactor[A] forSome { type A >: Null } + @deprecated("use scala.actors.scheduler.ForkJoinScheduler instead") type FJTaskScheduler2 = scala.actors.scheduler.ForkJoinScheduler @@ -13,6 +17,16 @@ package object actors { @deprecated("this class is going to be removed in a future release") type WorkerThread = java.lang.Thread + @deprecated("use scala.actors.scheduler.SingleThreadedScheduler instead") + type SingleThreadedScheduler = scala.actors.scheduler.SingleThreadedScheduler + + // This used to do a blind cast and throw a CCE after the package + // object was loaded. I have replaced with a variation that should work + // in whatever cases that was working but fail less exceptionally for + // those not intentionally using it. @deprecated("this value is going to be removed in a future release") - val ActorGC = scala.actors.Scheduler.impl.asInstanceOf[scala.actors.scheduler.ThreadPoolScheduler] + val ActorGC = scala.actors.Scheduler.impl match { + case x: scala.actors.scheduler.ActorGC => x + case _ => null + } } diff --git a/src/actors/scala/actors/remote/NetKernel.scala b/src/actors/scala/actors/remote/NetKernel.scala index 9c2b18ada2..fc79fdec54 100644 --- a/src/actors/scala/actors/remote/NetKernel.scala +++ b/src/actors/scala/actors/remote/NetKernel.scala @@ -140,7 +140,7 @@ private[remote] class NetKernel(service: Service) { def terminate() { // tell all proxies to terminate - proxies.valuesIterator foreach { p => p.send(Terminate, null) } + proxies.values foreach { _.send(Terminate, null) } // tell service to terminate service.terminate() diff --git a/src/actors/scala/actors/ActorGC.scala b/src/actors/scala/actors/scheduler/ActorGC.scala index af1b0ed82d..0fe94b09c9 100644 --- a/src/actors/scala/actors/ActorGC.scala +++ b/src/actors/scala/actors/scheduler/ActorGC.scala @@ -9,11 +9,11 @@ // $Id$ package scala.actors +package scheduler import java.lang.ref.{Reference, WeakReference, ReferenceQueue} import scala.collection.mutable.HashSet -import scala.actors.scheduler.TerminationMonitor /** * ActorGC keeps track of the number of live actors being managed by a @@ -29,19 +29,19 @@ trait ActorGC extends TerminationMonitor { self: IScheduler => /** Actors are added to refQ in newActor. */ - private val refQ = new ReferenceQueue[Reactor] + private val refQ = new ReferenceQueue[TrackedReactor] /** * This is a set of references to all the actors registered with * this ActorGC. It is maintained so that the WeakReferences will not be GC'd * before the actors to which they point. */ - private val refSet = new HashSet[Reference[t] forSome { type t <: Reactor }] + private val refSet = new HashSet[Reference[t] forSome { type t <: TrackedReactor }] /** newActor is invoked whenever a new actor is started. */ - override def newActor(a: Reactor) = synchronized { + override def newActor(a: TrackedReactor) = synchronized { // registers a reference to the actor with the ReferenceQueue - val wr = new WeakReference[Reactor](a, refQ) + val wr = new WeakReference[TrackedReactor](a, refQ) refSet += wr activeActors += 1 } @@ -71,20 +71,20 @@ trait ActorGC extends TerminationMonitor { activeActors <= 0 } - override def onTerminate(a: Reactor)(f: => Unit): Unit = synchronized { + override def onTerminate(a: TrackedReactor)(f: => Unit): Unit = synchronized { terminationHandlers += (a -> (() => f)) } - override def terminated(a: Reactor) = { + override def terminated(a: TrackedReactor) = { super.terminated(a) synchronized { // find the weak reference that points to the terminated actor, if any - refSet.find((ref: Reference[t] forSome { type t <: Reactor }) => ref.get() == a) match { + refSet.find((ref: Reference[t] forSome { type t <: TrackedReactor }) => ref.get() == a) match { case Some(r) => // invoking clear will not cause r to be enqueued r.clear() - refSet -= r.asInstanceOf[Reference[t] forSome { type t <: Reactor }] + refSet -= r.asInstanceOf[Reference[t] forSome { type t <: TrackedReactor }] case None => // do nothing } diff --git a/src/actors/scala/actors/scheduler/DaemonScheduler.scala b/src/actors/scala/actors/scheduler/DaemonScheduler.scala index 02f652db0b..257e847a6a 100644 --- a/src/actors/scala/actors/scheduler/DaemonScheduler.scala +++ b/src/actors/scala/actors/scheduler/DaemonScheduler.scala @@ -16,7 +16,7 @@ package scheduler */ object DaemonScheduler extends DelegatingScheduler { - def makeNewScheduler(): IScheduler = { + protected def makeNewScheduler(): IScheduler = { val sched = if (!ThreadPoolConfig.useForkJoin) { val s = new ResizableThreadPoolScheduler(true) s.start() diff --git a/src/actors/scala/actors/scheduler/DefaultThreadPoolScheduler.scala b/src/actors/scala/actors/scheduler/DefaultThreadPoolScheduler.scala deleted file mode 100644 index 4fed00ba26..0000000000 --- a/src/actors/scala/actors/scheduler/DefaultThreadPoolScheduler.scala +++ /dev/null @@ -1,49 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - -package scala.actors.scheduler - -import java.util.concurrent.{ThreadPoolExecutor, TimeUnit, LinkedBlockingQueue, - ThreadFactory} - -/** - * The <code>DefaultThreadPoolScheduler</code> class uses a default - * <code>ThreadPoolExecutor</code> for executing <code>Actor</code>s. - * - * It can be configured using the two JVM properties - * <code>actors.corePoolSize</code> and - * <code>actors.maxPoolSize</code> that control the initial and - * maximum size of the thread pool, respectively. - * - * @author Philipp Haller - */ -private[actors] class DefaultThreadPoolScheduler(daemon: Boolean) extends ThreadPoolScheduler(daemon) { - - executor = { - val workQueue = new LinkedBlockingQueue[Runnable] - - val threadFactory = new ThreadFactory { - def newThread(r: Runnable): Thread = { - val t = new Thread(r) - t setDaemon daemon - t - } - } - - new ThreadPoolExecutor(ThreadPoolConfig.corePoolSize, - ThreadPoolConfig.maxPoolSize, - 60000L, - TimeUnit.MILLISECONDS, - workQueue, - threadFactory, - new ThreadPoolExecutor.CallerRunsPolicy) - } - -} diff --git a/src/actors/scala/actors/scheduler/DelegatingScheduler.scala b/src/actors/scala/actors/scheduler/DelegatingScheduler.scala index d1c99d7c13..193b1e3e2b 100644 --- a/src/actors/scala/actors/scheduler/DelegatingScheduler.scala +++ b/src/actors/scala/actors/scheduler/DelegatingScheduler.scala @@ -48,7 +48,7 @@ private[actors] trait DelegatingScheduler extends IScheduler { } } - def newActor(actor: Reactor) = synchronized { + def newActor(actor: TrackedReactor) = synchronized { val createNew = if (sched eq null) true else sched.synchronized { @@ -65,9 +65,9 @@ private[actors] trait DelegatingScheduler extends IScheduler { } } - def terminated(actor: Reactor) = impl.terminated(actor) + def terminated(actor: TrackedReactor) = impl.terminated(actor) - def onTerminate(actor: Reactor)(f: => Unit) = impl.onTerminate(actor)(f) + def onTerminate(actor: TrackedReactor)(f: => Unit) = impl.onTerminate(actor)(f) override def managedBlock(blocker: ManagedBlocker): Unit = impl.managedBlock(blocker) diff --git a/src/actors/scala/actors/scheduler/ExecutorScheduler.scala b/src/actors/scala/actors/scheduler/ExecutorScheduler.scala index bcd524f345..8c29af604e 100644 --- a/src/actors/scala/actors/scheduler/ExecutorScheduler.scala +++ b/src/actors/scala/actors/scheduler/ExecutorScheduler.scala @@ -11,16 +11,57 @@ package scala.actors package scheduler -import java.util.concurrent.Callable +import java.util.concurrent.{Callable, ExecutorService} import scala.concurrent.ThreadPoolRunner /** + * The <code>ExecutorScheduler</code> object is used to create + * <code>ExecutorScheduler</code> instances. + * + * @author Philipp Haller + */ +object ExecutorScheduler { + + private def start(sched: ExecutorScheduler): ExecutorScheduler = { + sched.start() + sched + } + + /** Creates an <code>ExecutorScheduler</code> using the provided + * <code>ExecutorService</code>. + * + * @param exec the executor to use + * @return the scheduler + */ + def apply(exec: ExecutorService): ExecutorScheduler = + start(new ExecutorScheduler { + val executor: ExecutorService = exec + }) + + /** Creates an <code>ExecutorScheduler</code> using the provided + * <code>ExecutorService</code>. + * + * @param exec the executor to use + * @param term whether the scheduler should automatically terminate + * @return the scheduler + */ + def apply(exec: ExecutorService, term: Boolean): ExecutorScheduler = + start(new ExecutorScheduler { + val executor: ExecutorService = exec + override val terminate = term + }) + +} + +/** * The <code>ExecutorScheduler</code> class uses an * <code>ExecutorService</code> to execute <code>Actor</code>s. * * @author Philipp Haller */ -private[scheduler] trait ExecutorScheduler extends IScheduler with ThreadPoolRunner { +trait ExecutorScheduler extends Thread + with IScheduler with TerminationService + with ThreadPoolRunner { def execute(task: Runnable) { super[ThreadPoolRunner].execute(task.asInstanceOf[Task[Unit]]) diff --git a/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala b/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala index 54fab4fb11..ab4fca04ca 100644 --- a/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala +++ b/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala @@ -3,13 +3,15 @@ package scheduler import java.util.{Collection, ArrayList} import scala.concurrent.forkjoin._ +import scala.util.Random /** The <code>ForkJoinScheduler</code> is backed by a lightweight * fork-join task execution framework. * * @author Philipp Haller */ -class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean) extends Runnable with IScheduler with TerminationMonitor { +class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean, fair: Boolean) + extends Runnable with IScheduler with TerminationMonitor { private var pool = makeNewPool() // guarded by this private var terminating = false // guarded by this @@ -22,7 +24,7 @@ class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean protected val CHECK_FREQ = 10 def this(d: Boolean) { - this(ThreadPoolConfig.corePoolSize, ThreadPoolConfig.maxPoolSize, d) + this(ThreadPoolConfig.corePoolSize, ThreadPoolConfig.maxPoolSize, d, true) } def this() { @@ -65,12 +67,12 @@ class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean } if (terminating) - throw new QuitException + throw new QuitControl if (allActorsTerminated) { Debug.info(this+": all actors terminated") terminating = true - throw new QuitException + throw new QuitControl } if (!snapshoting) { @@ -81,12 +83,12 @@ class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean Debug.info(this+": drained "+num+" tasks") drainedTasks = list terminating = true - throw new QuitException + throw new QuitControl } } } } catch { - case _: QuitException => + case _: QuitControl => Debug.info(this+": initiating shutdown...") while (!pool.isQuiescent()) { try { @@ -106,11 +108,11 @@ class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean } override def executeFromActor(task: Runnable) { - // TODO: only pass RecursiveAction (with Runnable), and cast to it - val recAction = new RecursiveAction { - def compute() = task.run() - } - recAction.fork() + // in fair mode: 2% chance of submitting to global task queue + if (fair && Random.nextInt(50) == 1) + pool.execute(task) + else + task.asInstanceOf[RecursiveAction].fork() } /** Submits a closure for execution. diff --git a/src/actors/scala/actors/scheduler/QuitControl.scala b/src/actors/scala/actors/scheduler/QuitControl.scala new file mode 100644 index 0000000000..b217094c1e --- /dev/null +++ b/src/actors/scala/actors/scheduler/QuitControl.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +package scala.actors.scheduler + +import scala.util.control.ControlThrowable + +/** + * The <code>QuitControl</code> class is used to manage control flow + * of certain schedulers. + * + * @author Philipp Haller + */ +private[scheduler] class QuitControl extends ControlThrowable diff --git a/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala b/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala index ff74d0bc8b..3687138e0e 100644 --- a/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala +++ b/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala @@ -112,7 +112,7 @@ class ResizableThreadPoolScheduler(protected val terminate: Boolean, } if (terminating) - throw new QuitException + throw new QuitControl if (!suspending) { gc() @@ -129,19 +129,19 @@ class ResizableThreadPoolScheduler(protected val terminate: Boolean, Debug.info(this+": corePoolSize = "+coreSize+", maxPoolSize = "+maxSize) terminating = true - throw new QuitException + throw new QuitControl } } } else { drainedTasks = executor.shutdownNow() Debug.info(this+": drained "+drainedTasks.size()+" tasks") terminating = true - throw new QuitException + throw new QuitControl } } // sync } } catch { - case _: QuitException => + case _: QuitControl => executor.shutdown() // allow thread to exit } diff --git a/src/actors/scala/actors/scheduler/SchedulerService.scala b/src/actors/scala/actors/scheduler/SchedulerService.scala deleted file mode 100644 index dca8bb5b9c..0000000000 --- a/src/actors/scala/actors/scheduler/SchedulerService.scala +++ /dev/null @@ -1,80 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - -package scala.actors -package scheduler - -import scala.util.control.ControlException -import java.lang.{Runnable, Thread, InterruptedException} - -/** - * The abstract <code>SchedulerService</code> class allows subclasses - * to implement a custom <code>onShutdown</code> method, which is - * invoked when the runtime system has detected that all actors have - * been terminated. - * - * @version 0.9.18 - * @author Philipp Haller - */ -abstract class SchedulerService(daemon: Boolean) extends Thread with IScheduler with ActorGC { - - setDaemon(daemon) - - def this() = - this(false) - - private var terminating = false - - protected val CHECK_FREQ = 100 - - def onShutdown(): Unit - - override def run() { - try { - while (true) { - this.synchronized { - try { - wait(CHECK_FREQ) - } catch { - case _: InterruptedException => - } - if (terminating) - throw new QuitException - - gc() - - if (allActorsTerminated) - throw new QuitException - } - } - } catch { - case _: QuitException => - Debug.info(this+": initiating shutdown...") - // invoke shutdown hook - onShutdown() - // allow thread to exit - } - } - - /** Shuts down the scheduler. - */ - def shutdown(): Unit = synchronized { - terminating = true - } -} - -/** - * The <code>QuitException</code> class is used to manage control flow - * of certain schedulers and worker threads. - * - * @version 0.9.8 - * @author Philipp Haller - */ -private[actors] class QuitException extends Throwable with ControlException diff --git a/src/actors/scala/actors/scheduler/SimpleExecutorScheduler.scala b/src/actors/scala/actors/scheduler/SimpleExecutorScheduler.scala deleted file mode 100644 index 6c8814e90c..0000000000 --- a/src/actors/scala/actors/scheduler/SimpleExecutorScheduler.scala +++ /dev/null @@ -1,43 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - -package scala.actors -package scheduler - -import java.util.concurrent.ExecutorService - -/** - * The <code>SimpleExecutorScheduler</code> class uses an - * <code>ExecutorService</code> to execute <code>Actor</code>s. It - * does not start an additional thread. - * - * A <code>SimpleExecutorScheduler</code> attempts to shut down - * the underlying <code>ExecutorService</code> only if - * <code>terminate</code> is set to true. - * - * Otherwise, the <code>ExecutorService</code> must be shut down either - * directly or by shutting down the - * <code>SimpleExecutorScheduler</code> instance. - * - * @author Philipp Haller - */ -class SimpleExecutorScheduler(protected var executor: ExecutorService, - protected var terminate: Boolean) - extends TerminationService(terminate) with ExecutorScheduler { - - /* This constructor (and the var above) is currently only used to work - * around a bug in scaladoc, which cannot deal with early initializers - * (to be used in subclasses such as DefaultExecutorScheduler) properly. - */ - def this() { - this(null, true) - } - -} diff --git a/src/actors/scala/actors/scheduler/SingleThreadedScheduler.scala b/src/actors/scala/actors/scheduler/SingleThreadedScheduler.scala index 9eca972e90..f91351d1f5 100644 --- a/src/actors/scala/actors/scheduler/SingleThreadedScheduler.scala +++ b/src/actors/scala/actors/scheduler/SingleThreadedScheduler.scala @@ -54,11 +54,11 @@ class SingleThreadedScheduler extends IScheduler { isShutdown = true } - def newActor(actor: Reactor) {} - def terminated(actor: Reactor) {} + def newActor(actor: TrackedReactor) {} + def terminated(actor: TrackedReactor) {} // TODO: run termination handlers at end of shutdown. - def onTerminate(actor: Reactor)(f: => Unit) {} + def onTerminate(actor: TrackedReactor)(f: => Unit) {} def isActive = !isShutdown diff --git a/src/actors/scala/actors/scheduler/TerminationMonitor.scala b/src/actors/scala/actors/scheduler/TerminationMonitor.scala index 5510ebb095..82897f7afd 100644 --- a/src/actors/scala/actors/scheduler/TerminationMonitor.scala +++ b/src/actors/scala/actors/scheduler/TerminationMonitor.scala @@ -13,14 +13,15 @@ package scheduler import scala.collection.mutable.HashMap -trait TerminationMonitor { +private[scheduler] trait TerminationMonitor { + _: IScheduler => protected var activeActors = 0 - protected val terminationHandlers = new HashMap[Reactor, () => Unit] + protected val terminationHandlers = new HashMap[TrackedReactor, () => Unit] private var started = false /** newActor is invoked whenever a new actor is started. */ - def newActor(a: Reactor) = synchronized { + def newActor(a: TrackedReactor) = synchronized { activeActors += 1 if (!started) started = true @@ -32,7 +33,7 @@ trait TerminationMonitor { * @param a the actor * @param f the closure to be registered */ - def onTerminate(a: Reactor)(f: => Unit): Unit = synchronized { + def onTerminate(a: TrackedReactor)(f: => Unit): Unit = synchronized { terminationHandlers += (a -> (() => f)) } @@ -40,7 +41,7 @@ trait TerminationMonitor { * * @param a the actor that has terminated */ - def terminated(a: Reactor) = { + def terminated(a: TrackedReactor) = { // obtain termination handler (if any) val todo = synchronized { terminationHandlers.get(a) match { diff --git a/src/actors/scala/actors/scheduler/TerminationService.scala b/src/actors/scala/actors/scheduler/TerminationService.scala index b6f03f11e5..aa047eedfa 100644 --- a/src/actors/scala/actors/scheduler/TerminationService.scala +++ b/src/actors/scala/actors/scheduler/TerminationService.scala @@ -11,7 +11,7 @@ package scala.actors package scheduler -import java.lang.{Runnable, Thread, InterruptedException} +import java.lang.{Thread, InterruptedException} /** * The <code>TerminationService</code> class starts a new thread @@ -21,11 +21,16 @@ import java.lang.{Runnable, Thread, InterruptedException} * * @author Philipp Haller */ -abstract class TerminationService(terminate: Boolean) - extends Thread with IScheduler with TerminationMonitor { +private[scheduler] trait TerminationService extends TerminationMonitor { + _: Thread with IScheduler => private var terminating = false + /** Indicates whether the scheduler should terminate when all + * actors have terminated. + */ + protected val terminate = true + protected val CHECK_FREQ = 50 def onShutdown(): Unit @@ -39,15 +44,15 @@ abstract class TerminationService(terminate: Boolean) } catch { case _: InterruptedException => } - if (terminating) - throw new QuitException - if (terminate && allActorsTerminated) - throw new QuitException + if (terminating || (terminate && allActorsTerminated)) + throw new QuitControl + + gc() } } } catch { - case _: QuitException => + case _: QuitControl => Debug.info(this+": initiating shutdown...") // invoke shutdown hook onShutdown() @@ -60,4 +65,5 @@ abstract class TerminationService(terminate: Boolean) def shutdown(): Unit = synchronized { terminating = true } + } diff --git a/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala b/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala index 93112ae80a..6efe9b007d 100644 --- a/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala +++ b/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala @@ -11,22 +11,19 @@ package scala.actors package scheduler +import util.Properties.{ javaVersion, javaVmVendor, isJavaAtLeast, propIsSetTo, propOrNone } + /** * @author Erik Engbrecht + * @author Philipp Haller */ -object ThreadPoolConfig { +private[actors] object ThreadPoolConfig { private val rt = Runtime.getRuntime() private val minNumThreads = 4 - private def getIntegerProp(propName: String): Option[Int] = { - try { - val prop = System.getProperty(propName) - Some(Integer.parseInt(prop)) - } catch { - case ace: java.security.AccessControlException => None - case nfe: NumberFormatException => None - } - } + private def getIntegerProp(propName: String): Option[Int] = + try propOrNone(propName) map (_.toInt) + catch { case _: SecurityException | _: NumberFormatException => None } val corePoolSize = getIntegerProp("actors.corePoolSize") match { case Some(i) if i > 0 => i @@ -37,30 +34,21 @@ object ThreadPoolConfig { } val maxPoolSize = { - val preMaxSize = getIntegerProp("actors.maxPoolSize") match { - case Some(i) => i - case _ => 256 - } + val preMaxSize = getIntegerProp("actors.maxPoolSize") getOrElse 256 if (preMaxSize >= corePoolSize) preMaxSize else corePoolSize } private[actors] def useForkJoin: Boolean = - try { - val fjProp = System.getProperty("actors.enableForkJoin") - if (fjProp != null) - fjProp.equals("true") - else { - val javaVersion = System.getProperty("java.version") - val jvmVendor = System.getProperty("java.vm.vendor") + try !propIsSetTo("actors.enableForkJoin", "false") && + (propIsSetTo("actors.enableForkJoin", "true") || { Debug.info(this+": java.version = "+javaVersion) - Debug.info(this+": java.vm.vendor = "+jvmVendor) - (javaVersion.indexOf("1.6") != -1 || - javaVersion.indexOf("1.7") != -1) && + Debug.info(this+": java.vm.vendor = "+javaVmVendor) + // on IBM J9 1.6 do not use ForkJoinPool - (jvmVendor.indexOf("Sun") != -1) - } - } catch { - case se: SecurityException => false + // XXX this all needs to go into Properties. + isJavaAtLeast("1.6") && ((javaVmVendor contains "Sun") || (javaVmVendor contains "Apple")) + }) + catch { + case _: SecurityException => false } - } diff --git a/src/actors/scala/actors/scheduler/ThreadPoolScheduler.scala b/src/actors/scala/actors/scheduler/ThreadPoolScheduler.scala deleted file mode 100644 index 2eb18645ff..0000000000 --- a/src/actors/scala/actors/scheduler/ThreadPoolScheduler.scala +++ /dev/null @@ -1,81 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - -package scala.actors.scheduler - -import java.util.concurrent.ThreadPoolExecutor -import scala.actors.Debug -import scala.concurrent.ManagedBlocker - -/** - * The <code>ThreadPoolScheduler</code> class uses a - * <code>ThreadPoolExecutor</code> to execute <code>Actor</code>s. - * - * A <code>ThreadPoolScheduler</code> attempts to shut down - * the underlying <code>ThreadPoolExecutor</code> only if - * <code>terminate</code> is set to true. - * - * Otherwise, the <code>ThreadPoolExecutor</code> must be shut down - * either directly or by shutting down the - * <code>ThreadPoolScheduler</code> instance. - * - * @author Philipp Haller - */ -class ThreadPoolScheduler(protected var executor: ThreadPoolExecutor, - protected val terminate: Boolean, - protected val daemon: Boolean) - extends Thread with ExecutorScheduler with TerminationMonitor { - - setDaemon(daemon) - - private var terminating = false // guarded by this - protected val CHECK_FREQ = 10 - - /* This constructor (and the var above) is currently only used to work - * around a bug in scaladoc, which cannot deal with early initializers - * (to be used in subclasses such as DefaultThreadPoolScheduler) - * properly. - */ - def this(d: Boolean) { - this(null, true, d) - } - - override def run() { - try { - while (true) { - this.synchronized { - try { - wait(CHECK_FREQ) - } catch { - case _: InterruptedException => - } - - if (terminating || (terminate && allActorsTerminated)) - throw new QuitException - - gc() - } - } - } catch { - case _: QuitException => - Debug.info(this+": initiating shutdown...") - // invoke shutdown hook - onShutdown() - // allow thread to exit - } - } - - /** Shuts down the scheduler. - */ - def shutdown(): Unit = synchronized { - terminating = true - } - -} |