summaryrefslogtreecommitdiffstats
path: root/dalvik
Commit message (Collapse)AuthorAgeFilesLines
* am 46fc50e8: Merge "Support wrapping app processes to inject debug ↵Jeff Brown2011-05-241-0/+27
|\ | | | | | | | | | | | | instrumentation. Bug: 4437846" * commit '46fc50e810eaab93f2787b355257ab1e837d8bf7': Support wrapping app processes to inject debug instrumentation. Bug: 4437846
| * Merge "Support wrapping app processes to inject debug instrumentation. Bug: ↵Jeff Brown2011-05-241-0/+27
| |\ | | | | | | | | | 4437846"
| | * Support wrapping app processes to inject debug instrumentation.Jeff Brown2011-05-201-0/+27
| | | | | | | | | | | | | | | | | | Bug: 4437846 Change-Id: I8d66b13f1c1dc9c30f72033f190121979a44b212
| * | Disable verbose socket logging.Jeff Sharkey2011-05-171-1/+1
| |/ | | | | | | Change-Id: I3b8a1a532b186fee81cca0c7eb9199a436570999
* | Expose accept(2).Elliott Hughes2011-05-191-19/+0
| | | | | | | | | | | | | | | | | | | | | | The implementation of PlainSocketImpl.accept is made ugly by the fact that the SocketImpl we mutate may share its FileDescriptor with a SocketChannel, so we need to mutate the FileDescriptor itself, and can't simply swap in a new one. I've raised http://b/4452981 to see if we can integrate the nio and io socket classes more closely, to avoid this kind of mess. Bug: 3107501 Change-Id: I4964b64c25e936a44d1e4c22504ca29bba247ab6
* | Implement recvfrom(2).Elliott Hughes2011-05-191-26/+3
| | | | | | | | | | | | | | This one's a little bit hairy because of multiple return values. Bug: 3107501 Change-Id: I3bd35647d94bb6bc2192d6f31a39ecca07a3926e
* | Add sendto(2) and reimplement all network writes in terms of it.Elliott Hughes2011-05-161-30/+0
| | | | | | | | | | | | | | Note that this doesn't fix http://b/4182806. Bug: 3107501 Change-Id: I9b56eae226389a63a12b4c0499d40d5a54a462e2
* | Quieten socket tagging.Elliott Hughes2011-05-161-1/+1
| | | | | | | | | | | | This is pretty noisy, and not our problem. Change-Id: I5fbd54ccbcbf66d089455efd68cf68e5a91aef20
* | Remove OSNetworkSystem.close.Elliott Hughes2011-05-161-22/+0
| | | | | | | | | | | | | | | | For now I'm keeping AsynchronousCloseMonitor as a special case in native code. We can see about doing something more general-purpose in a later pass. Bug: 3107501 Change-Id: Ib79b9fc0bebfafc2d14896d957bd8591ae8e6e97
* | resolved conflicts for merge of 1e8d508f to dalvik-devJeff Sharkey2011-05-131-3/+92
|\ \ | |/ | | | | Change-Id: Id0739d4e567b112cbea48f5ecb7dd46425da1a36
| * 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
* | Reimplement OSNetworkSystem.isConnected in Java.Elliott Hughes2011-05-121-8/+0
| | | | | | | | | | | | We can do this in Java now we've exposed poll(2). Change-Id: I9f2700d09134198c1cd2681e3814fb482e8e271c
* | Expose poll(2) and reimplement java.nio.channels.Selector.Elliott Hughes2011-05-111-5/+0
| | | | | | | | | | | | | | | | This also adds UnsafeArrayList<T>, which is like ArrayList but lets you access the underlying array (as opposed to ArrayList.toArray which creates a copy). Bug: 3107501 Change-Id: I8dc570a9fd7951b1435047017ea7aa19f8f8fc53
* | Clean up the select(2) implementation.Elliott Hughes2011-05-111-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I wasn't planning on touching this code (since I want to replace it), but the purported "fix" for http://code.google.com/p/android/issues/detail?id=6309 was actually a regression. The supplied test fails on the RI. This patch replaces the bogus test with new tests, and reverts the old "fix". This was found while trying to work out what "true" and "false" return values from OSNetworkSystem.select are supposed to mean. This patch also switches to a more traditional int return value. Bug: 3107501 Change-Id: Iddce55e081d440b7eb3ddcf94db7d0739dc89c70
* | DatagramSocket.disconnect is really a connect(2) of an AF_UNSPEC sockaddr.Elliott Hughes2011-05-101-4/+0
| | | | | | | | | | Bug: 3107501 Change-Id: Ib04369b9ca63ff3fe7eb87dcbf2926fe704813e3
* | Expose connect(2).Elliott Hughes2011-05-091-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The new NET_FAILURE_RETRY in Posix.cpp is intended to replace the legacy one in NetFd.h, but during the transition we need both. The new one also takes care of the asynchronous Socket.close semantics, and changes the behavior when the FileDescriptor is invalid on entry: that is now reported as EBADF; it's only reported as "Socket closed" when we've been round the loop at least once, giving us reason to believe the socket was ever open. Having had to debug this distinction, I think the new semantics are less confusing. Bug: 3107501 Change-Id: I243dc4fa2eddde7ba40e9b66ec8fc555bc4e80f9
* | Expose bind(2).Elliott Hughes2011-05-091-6/+0
|/ | | | | | | | | | I've renamed the java.net.InetAddress to struct sockaddr conversion functions too, after initially screwing up this patch by copy & pasting a usage of the one that only one caller actually wants. Now the name's so ugly no-one will be likely to use it by accident. Bug: 3107501 Change-Id: I869a8d27fc40e462505e02bf25a67e771a403e92
* 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-2912-86/+392
|\ | | | | | | | | * commit 'e9af8901fc4ed7c05d085e2e492f5dcc857f0146': SamplingProfilerIntegration and SamplingProfiler improvements (2/3)
| * SamplingProfilerIntegration and SamplingProfiler improvements (2/3)Brian Carlstrom2011-03-2912-86/+392
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2411-1744/+1936
|\ \ | |/ | | | | Change-Id: I7765cd4bf03f0b18e60848c30dcce30cbdd7c77b
| * Import SamplingProfiler from http://code.google.com/p/dalvik/Brian Carlstrom2011-03-2411-1741/+1936
| | | | | | | | | | | | | | | | | | 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