summaryrefslogtreecommitdiffstats
path: root/dalvik/src/main
Commit message (Collapse)AuthorAgeFilesLines
* Add Socket tagging for granular data accounting.Jeff Sharkey2011-05-131-4/+92
| | | | | | | | Changes BlockGuard to maintain a set of "tags" for the current thread, which it communicates to kernel before each Socket use. Also changes HttpConnectionPool to tag/untag sockets as they are recycled. Change-Id: I33e614f1f570466bdffbf07cc5c718f18b8f3773
* Fix non-blocking connects.Elliott Hughes2011-05-031-3/+1
| | | | | | | | | | The key change here is reintroducing the boolean return value, which we need as long as the native code treats EINPROGRESS as a special case which doesn't throw. The rest is just drive-by incremental cleanup of the code. Change-Id: I761b052adbb14e912c3853a35327f8a589cd4023
* Rewrite blocking connects in terms of the non-blocking primitives.Elliott Hughes2011-05-021-9/+2
| | | | | | | | | | | | | | | | | | | | | This simplifies OSNetworkSystem, getting us closer to replacing the connect(2)-related bits with our new POSIX interface. It also lets us remove cruft on the Java side that was resetting the socket's blocking/non-blocking state (which should never have been touched), which in turn fixes bug 4193212. Detail messages for socket timeouts get better too, now we're throwing on the Java side. The only thing that's worse is that we used to get away with throwing a checked exception from native code, which simplified our "throws" clauses. Now we actually have to jump through a few hoops to make javac happy. (Especially awkward because SocketTimeoutException isn't a SocketException.) Stupid checked exceptions. Bug: 4193212 Bug: 3107501 Change-Id: I00695d22094e6d785458dfbb7050fbaecf2db89f
* Finish setsockopt(2).Elliott Hughes2011-04-061-5/+0
| | | | | Bug: 3107501 Change-Id: I8f026dcba78acb555834bdcc594e114238f3cc52
* Ensure that the zygote is single-threaded before forking.Elliott Hughes2011-04-051-0/+18
| | | | | | | We really need to wait for the pthreads to exit. Bug: 4235038 Change-Id: Ic0ce32be80bcdc27ff8fc6ac27fa37f7c3e17e0c
* Implement reference queuing in managed code.Carl Shapiro2011-03-301-0/+3
| | | | | | | | | | | | | This change adds a thread to the core library which receives a list of references after a garbage collection and enqueues each element. This list is constructed by linking together the pendingNext field of cleared references into a circular queue. To support this change, the pendingNext field has been replaced by the new zombie field for the purposes of providing a strongly reachable location within a FinalizerReference class instance. Change-Id: Id09133e44c850797e7f14c5471123a036d027c80
* Add getsockname(2) and getsockopt(2).Elliott Hughes2011-03-301-20/+5
| | | | | Bug: 3107501 Change-Id: Ibb0d5a576ecb46e51dbda6051776145eec9e7fe1
* am e9af8901: SamplingProfilerIntegration and SamplingProfiler improvements (2/3)Brian Carlstrom2011-03-2911-80/+390
|\ | | | | | | | | * commit 'e9af8901fc4ed7c05d085e2e492f5dcc857f0146': SamplingProfilerIntegration and SamplingProfiler improvements (2/3)
| * SamplingProfilerIntegration and SamplingProfiler improvements (2/3)Brian Carlstrom2011-03-2911-80/+390
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: frameworks/base - fix profiling to collect data beyond the first snapshot - avoid many small files, accumulate data over process lifetime libcore: - add support for VM specific sampling, trying to cut down overhead - added support for converting snapshot files to text format - fixed race in profiler when stopping dalvik - added VMStack.setThreadStackTrace interface for filling a stack trace into an existing StackTraceElement[] Details: frameworks/base Changed snapshots from text to binary hprof format (bumping version to 3) Changed from one file per snapshot to one file per process lifetime. Restart profiling after snapshot. core/java/com/android/internal/os/SamplingProfilerIntegration.java Add quick test in maybeSnapshot to avoid doing work when the SamplingProfilerIntegration is disabled. Make maybeSnapshot private. Remove unneeded memory allocation in handleLowMemory. core/java/android/app/ActivityThread.java libcore Added ThreadSampler interface. This allows VM specific thread sampling optimizations. The portable version continues to use Thread.getStackTrace(). dalvik/src/main/java/dalvik/system/profiler/ThreadSampler.java dalvik/src/main/java/dalvik/system/profiler/PortableThreadSampler.java dalvik/src/main/java/dalvik/system/profiler/SamplingProfiler.java Add VMStack.setThreadStackTrace and use in new DalvikThreadSampler to avoid allocating a full stack trace when only a limited depth is desired. dalvik/src/main/java/dalvik/system/profiler/DalvikThreadSampler.java dalvik/src/main/java/dalvik/system/VMStack.java Refactored BinaryHprof.readMagic out of BinaryHprofReader so it can be used by HprofBinaryToAscii converter to probing file types. Added magic number constant to be shared between readMagic and BinaryHprofWriter. dalvik/src/main/java/dalvik/system/profiler/BinaryHprof.java dalvik/src/main/java/dalvik/system/profiler/BinaryHprofReader.java dalvik/src/main/java/dalvik/system/profiler/BinaryHprofWriter.java dalvik/src/main/java/dalvik/system/profiler/HprofBinaryToAscii.java Removed unneeded HprofWriter interface. Changed to simpler static interface to write HprofData to binary and text formats. dalvik/src/main/java/dalvik/system/profiler/HprofWriter.java dalvik/src/main/java/dalvik/system/profiler/AsciiHprofWriter.java dalvik/src/main/java/dalvik/system/profiler/BinaryHprofWriter.java dalvik/src/test/java/dalvik/system/profiler/SamplingProfilerTest.java Added support for reading snapshot files created by SamplingProfilerIntegration by stripping the text header to allow easier conversion to the text format. dalvik/src/main/java/dalvik/system/profiler/HprofBinaryToAscii.java Fixed race between Sampler and SamplingProfiler.stop. SamplingProfiler.stop previously simply called the Sampler's TimerTask.cancel method, but this does not wait for a currently running Sampler to finish. The TimerTask documentation says the only reliable way to do this is to have the run() cancel itself, so that is what is now done, with new code to ensure that SamplingProfiler.stop does not return until the Sampler has been terminated. dalvik/src/main/java/dalvik/system/profiler/SamplingProfiler.java dalvik Refactored VMStack_getThreadStackTrace to create helper getTraceBuf used to implement new VMStack_setThreadStackTrace. The new version interface fills an existing StackTraceElement[], avoid allocating unnecessary StackTraceElements. vm/native/dalvik_system_VMStack.c Refactor dvmGetStackTraceRaw to create dvmSetStackTraceRaw which fills in an existing, potentially smaller, StackTraceElement[]. vm/Exception.c vm/Exception.h Change stack depths to be unsigned to avoid signed/unsigned comparison warnings. vm/Ddm.c vm/Exception.c vm/Exception.h Change-Id: Id65df6e72b7c727a0c8af15dbf6943297c591541
* | Add socket(2) and start adding setsockopt(2).Elliott Hughes2011-03-291-4/+0
| | | | | | | | | | | | | | | | I've added just enough setsockopt to keep the hack from our old socket creation code. More later (but not necessarily right away). Bug: 3107501 Change-Id: Id57bdd3c760bc58ed79d675b268c55493cbc24c8
* | Add sendfile(2).Elliott Hughes2011-03-291-18/+0
| | | | | | | | | | | | | | | | | | | | | | This patch marks the end of OSFileSystem. Having to support a Java "long*" for sendfile(2) gave me an opportunity to go back and improve my ioctl(2) to use a corresponding "int*" equivalent, instead of its previous special-case hack. Bug: 3107501 Change-Id: I9fde4777700552263fab4fe9aeb556174163e3dc
* | Add readv(2)/writev(2).Elliott Hughes2011-03-291-12/+0
| | | | | | | | | | | | | | | | | | | | The old implementation would cheat if it was given non-direct buffers, copying them into newly-allocated direct buffers. (The network Channel implementations are worse: they copy all the data into a single buffer, and then read/write that. I'll get to them eventually.) Bug: 3107501 Change-Id: I1655bacb042e7ebcde7e5bc5cf2c71e7ce5e30af
* | Add ioctl(2) for int*.Elliott Hughes2011-03-281-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | I'm not adding the "struct ifreq" stuff yet because that's really hairy and I plan on rewriting the NetworkInterface implementation anyway, so it'll mainly be based on /proc. With any luck, we won't even need those other ioctls then. I'm not sure _this_ ioctl is a good idea, but it does seem like a slight improvement on the old code, and we can always move it back out if/when these APIs become more public. Bug: 3107501 Change-Id: Iceac15e4a107c33bfc8795976a747c2ffa59a183
* | Merge "Add write(2)." into dalvik-devElliott Hughes2011-03-281-12/+0
|\ \
| * | Add write(2).Elliott Hughes2011-03-251-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that this is a functional change, because the old code was wrong: it assumed that short writes don't happen. I thought we'd (I'd) cleaned this up just recently, but it looks like I must have only gone through the network code. Embarrassing. This also cleans up the previous read change a bit, factoring out a bit more duplication, and taking advantage of the fact that we now get decent exceptions thrown from invalid FileDescriptors (meaning we can remove explicit checks). Bug: 3107501 Change-Id: I8bd5324836c9d151dceaef5b84ec523a67391b64
* | | Merge "Minor tweak to NativeStart" into dalvik-devAndy McFadden2011-03-281-3/+2
|\ \ \ | |/ / |/| |
| * | Minor tweak to NativeStartAndy McFadden2011-03-251-3/+2
| | | | | | | | | | | | | | | | | | | | | There's no value in pretending to be Runnable, and the VM init is a bit cleaner if we stop. Change-Id: Ie6043b4621ae72db1190e79769aaa1771c83197c
* | | Add read(2).Elliott Hughes2011-03-251-12/+0
|/ / | | | | | | | | | | | | For both byte[]s and ByteBuffers. Bug: 3107501 Change-Id: I93b781069ade4507371c8fe8c5fda0163fbb2dbb
* | resolved conflicts for merge of cfa84a2a to dalvik-devBrian Carlstrom2011-03-2410-1731/+1923
|\ \ | |/ | | | | Change-Id: I7765cd4bf03f0b18e60848c30dcce30cbdd7c77b
| * Import SamplingProfiler from http://code.google.com/p/dalvik/Brian Carlstrom2011-03-2410-1728/+1923
| | | | | | | | | | | | | | | | | | cp ~/android/dalvik/profiler/src/main/java/dalvik/profiler/* ~/android/master/libcore/dalvik/src/main/java/dalvik/system/profiler/ cp ~/android/dalvik/profiler/src/test/java/dalvik/profiler/* ~/android/master/libcore/dalvik/src/test/java/dalvik/system/profiler/ perl -p -i -e 's/package dalvik.profiler;/package dalvik.system.profiler;/' ~/android/master/libcore/dalvik/src/*/java/dalvik/system/profiler/*.java perl -p -i -e 's/import dalvik.profiler./import dalvik.system.profiler./' ~/android/master/libcore/dalvik/src/*/java/dalvik/system/profiler/*.java Change-Id: Iae3f63327f4a9dde7f037e69c22057e2ea704aaa
* | Add fcntl(2).Elliott Hughes2011-03-241-9/+0
| | | | | | | | | | | | | | | | | | | | I initially used overloading, but that actually decreases safety in practice because which overload you need is (uniquely) determined by the specific command you're issuing. Forcing callers to explicitly state what they're doing works around this. As it was, I had to use strace(1) to find my bug. Bug: 3107501 Change-Id: Ia54b72dd6453372922f01b22f382eb93ac91aaa7
* | Add listen(2).Elliott Hughes2011-03-241-4/+0
| | | | | | | | | | Bug: 3107501 Change-Id: I3677bb4ddb3f3d0e58a6833165504f47bb309630
* | Add shutdown(2).Elliott Hughes2011-03-241-8/+0
| | | | | | | | | | Bug: 3107501 Change-Id: I30354c4cc6e86a4e7b0e3f84e95719539db1d297
* | Add open(2).Elliott Hughes2011-03-221-8/+0
| | | | | | | | | | Bug: 3107501 Change-Id: I404030b4c678862465d04f723a6a324663e0af25
* | Merge "Remove more dead SecurityManager cruft." into dalvik-devElliott Hughes2011-03-221-7/+2
|\ \
| * | Remove more dead SecurityManager cruft.Elliott Hughes2011-03-221-7/+2
| | | | | | | | | | | | | | | | | | (Requires corresponding dalvik change.) Change-Id: I65cd76ae056d4a1ff5f1a3e168b118a47cf09ff5
* | | Move finalization into the core library.Carl Shapiro2011-03-214-12/+49
|/ / | | | | | | Change-Id: I969ecc25f2a7e655e1093855514102662846dfe1
* | Add lseek(2).Elliott Hughes2011-03-181-4/+0
| | | | | | | | | | Bug: 3107501 Change-Id: Ie27e2ae1c7d37de5f02b1d81ee2005182339f881
* | Add ftruncate(2).Elliott Hughes2011-03-181-5/+0
| | | | | | | | | | | | | | | | | | The claim that "the port library" modifies the file offset appears to only ever have been true of Harmony's Win32 implementation. Certainly, this is not the behavior of ftruncate(2), so we can lose the cruft. Bug: 3107501 Change-Id: I35092fd986296b78c4847c7215765f9997339f37
* | Add sysconf(3).Elliott Hughes2011-03-181-4/+0
| | | | | | | | | | | | | | | | This gives us a getpagesize(3) replacement right now, and will let us implement Runtime.availableProcessors here rather than in the VM in a later change. Bug: 3107501 Change-Id: I6fc1f83d36b026fbe8d37eca525550479677f2de
* | Add fstat(2), lstat(2), and stat(2).Elliott Hughes2011-03-171-4/+0
| | | | | | | | | | Bug: 3107501 Change-Id: Ic36f9ffd03446d6e0189470f42abdadde57327df
* | Add fsync(2) and fdatasync(2).Elliott Hughes2011-03-171-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Interesting parts to this change: * first BlockGuard support (and general delegation support). * first rethrowing of ErrnoException as IOException. * switching FileChannelImpl from int to FileDescriptor. The special case in FileDescriptor.sync has been removed. Testing with the RI showed that it doesn't treat syncing a FileDescriptor that corresponds to a socket as a special case --- it throws SyncFailedException just like normal. Bug: 3107501 Change-Id: I99faf120bd802aec0397a79772ed38c5e1542fed
* | Expose POSIX constants.Elliott Hughes2011-03-151-6/+4
| | | | | | | | | | | | | | | | | | And use them, too. This patch is a little confusing because we already had constants in Java that were using the POSIX names but that didn't actually correspond to the constants whose names they'd stolen. Ugh. Bug: 3107501 Change-Id: Ib64a109c9340b0ecdf80bec91074206c001f455a
* | Remove the stopAtPrivileged argument.Dan Bornstein2011-03-101-8/+4
| | | | | | | | | | | | It's superfluous now. Change-Id: I5628797b1296a41bfe72e535efaf18cd17e12fd4
* | Use -fvisibility and clean up a little.Elliott Hughes2011-03-081-4/+0
| | | | | | | | | | | | | | The visibility change isn't obviously useful, but it's a good excuse to clean up some of our networking code a little. Change-Id: I165b32b9c76a3707c512e07de07992f63673ab4f
* | Clean up of test-related dalvik.annotation classesBrian Carlstrom2011-03-037-241/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused dalvik.annotations related to tests dalvik.annotation.HostController dalvik.annotation.TestInfo dalvik.annotation.TestStatus dalvik.annotation.Timeout dalvik.annotation.VirtualTestTarget Deprecate two public dalvik.annotations related to tests. While they appear in the api xml files, they aren't show in our javadoc. dalvik.annotation.TestTarget dalvik.annotation.TestTargetClass Change-Id: I2f2aa41da0941718e4717d7ee8021606910f75f2
* | Fix more FindBugs warnings: RR_NOT_CHECKED.Elliott Hughes2011-02-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | "This method ignores the return value of one of the variants of java.io.InputStream.read() which can return multiple bytes. If the return value is not checked, the caller will not be able to correctly handle the case where fewer bytes were read than the caller requested. This is a particularly insidious kind of bug, because in many programs, reads from input streams usually do read the full amount of data requested, causing the program to fail only sporadically." Change-Id: I7d7c62836f2037f0cbb4bb0708bd4f034a22a2fc
* | am 2f323ffc: Merge "Move state from Sampler to SamplingProfiler that needs ↵Brian Carlstrom2011-02-241-25/+30
|\ \ | |/ | | | | | | | | | | to be preserved across a profiler restart" * commit '2f323ffc114d439cbeeb780845e5d1b2a88f85f9': Move state from Sampler to SamplingProfiler that needs to be preserved across a profiler restart
| * Move state from Sampler to SamplingProfiler that needs to be preserved ↵Brian Carlstrom2011-02-241-25/+30
| | | | | | | | | | | | across a profiler restart Change-Id: I39acb54cca5b98c7f147e2d9cc083c6ab4b17707
* | Simplify internal libcore logging.Elliott Hughes2011-02-223-19/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose LOGE and friends for use from Java. This is handy because it lets me use printf debugging even when I've broken String or CharsetEncoder or something equally critical. It also lets us remove internal use of java.util.logging, which is slow and ugly. I've also changed Thread.suspend/resume/stop to actually throw UnsupportedOperationException rather than just logging one and otherwise doing nothing. Bug: 3477960 Change-Id: I0c3f804b1a978bf9911cb4a9bfd90b2466f8798f
* | Fix various FindBugs warnings.Elliott Hughes2011-02-171-13/+8
| | | | | | | | | | | | | | | | | | | | | | | | Only the ChunkHandler and ZoneInfo ones were real bugs. The former is only called with one input value that doesn't exercise the bug, and the latter would cause us to think that a time zone that stopped using daylight time before 1970 was still using daylight time (which would defeat various optimizations, but should otherwise be harmless). The other stuff is trivia not worth individual changes. Change-Id: Ib0752560cd16edc6538d1fc2b234451a66d48171
* | Fix dalvik.system FindBugs warnings.Elliott Hughes2011-02-172-2/+5
| | | | | | | | Change-Id: I9cb09b8b9b0b21c899b08a852cc6f277dbb67bcf
* | Refactor DexClassLoader and PathClassLoader.Dan Bornstein2011-02-164-734/+595
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This resulted in the creation of two new classes: DexPathList contains most of the common functionality, namely managing the two path lists (dex/resource files and native library directories) plus all the salient initialization and lookup code. BaseDexClassLoader provides the ClassLoader API, mostly by making calls to a contained DexPathList instance. The two original classes just become trivial subclasses which take different constructor args and make correspondingly different super() calls in their respective constructors. I took the opportunity to remove the ability for PathClassLoader to take directories on the dex/resource list. This functionality hadn't ever been used, at least not since well before 1.0. Change-Id: I92ed300417431d0e0ac4c5ecf2f10d6a9b0691c7
* | Remove the obsolete TouchDex code.Elliott Hughes2011-02-104-716/+0
| | | | | | | | | | | | | | Apparently, this is how we did the first-boot dexing before we had a package manager. Change-Id: I6fce0fb30ab9dc2e7ebb0c4177540e92677c92b9
* | Move more of the system properties handling into managed code.Elliott Hughes2011-02-103-32/+26
| | | | | | | | | | Bug: 3413364 Change-Id: Ifc9b54255e11fd7df5517b88d8774dd747a7ec3d
* | am 7190be77: Restore the code for optimized file specification.Dan Bornstein2011-02-091-3/+4
|\ \ | |/ | | | | | | * commit '7190be77a29ad8f35b044ec591cb2b449f3ea8a1': Restore the code for optimized file specification.
| * Restore the code for optimized file specification.Dan Bornstein2011-02-091-3/+4
| | | | | | | | | | | | | | This bit got removed due to a copy-paste mishap. Bug: 3439372 Change-Id: If4653ec77bdc9b629ed4f5ba953be3eef6315b97
* | Merge "Stub out and deprecate gcSoftReferences." into dalvik-devCarl Shapiro2011-02-081-3/+4
|\ \
| * | Stub out and deprecate gcSoftReferences.Carl Shapiro2011-02-071-3/+4
| | | | | | | | | | | | Change-Id: I5c4fe0bc9ed1dd4b4e1324e2c090815f97e4463f
* | | resolved conflicts for merge of 6186821c to dalvik-devJesse Wilson2011-02-071-2/+1
|\ \ \ | |/ / |/| / | |/ Change-Id: Ic6f0172767d6feedb188d3a5e7488a67702ef8c4