OSDN Git Service

android-x86/dalvik.git
14 years agoMerge change I71684d91
Android (Google) Code Review [Wed, 4 Nov 2009 02:01:55 +0000 (21:01 -0500)]
Merge change I71684d91

* changes:
  CharsetDecoderICU/CharsetEncoderICU should take arrayOffset into account.

14 years agoMerge change Ic80147bd
Android (Google) Code Review [Wed, 4 Nov 2009 01:46:08 +0000 (20:46 -0500)]
Merge change Ic80147bd

* changes:
  Adding timeouts to jtreg runner.

14 years agoAdding timeouts to jtreg runner.
Jesse Wilson [Wed, 4 Nov 2009 00:45:07 +0000 (16:45 -0800)]
Adding timeouts to jtreg runner.

Also fixing some problems with the Android.mk which was
pointing at an old version of the Run class.

14 years agoCharsetDecoderICU/CharsetEncoderICU should take arrayOffset into account.
Elliott Hughes [Tue, 3 Nov 2009 23:52:10 +0000 (15:52 -0800)]
CharsetDecoderICU/CharsetEncoderICU should take arrayOffset into account.

CharsetDecoderICU and CharsetEncoderICU special-case array-backed ByteBuffers
and CharBuffers for performance reasons, but they shouldn't assume that the
backing array always has offset 0.

An external user hit this while using the jAudioTagger library.

Test cases from user submission:
http://code.google.com/p/android/issues/detail?id=4237

See also: 2234697

14 years agoRemove more @KnownFailures now I've run tests.AllTests.
Elliott Hughes [Tue, 3 Nov 2009 21:32:16 +0000 (13:32 -0800)]
Remove more @KnownFailures now I've run tests.AllTests.

A lunchtime run of the full suite turned up more.

14 years agoHide JIT-specific constants when JIT is not configured.
Ben Cheng [Tue, 3 Nov 2009 20:20:28 +0000 (12:20 -0800)]
Hide JIT-specific constants when JIT is not configured.

14 years agoMerge change Ia61d31e2
Android (Google) Code Review [Tue, 3 Nov 2009 19:52:25 +0000 (14:52 -0500)]
Merge change Ia61d31e2

* changes:
  Remove @KnownFailure from a bunch of tests that now pass.

14 years agoRemove @KnownFailure from a bunch of tests that now pass.
Elliott Hughes [Tue, 3 Nov 2009 19:44:56 +0000 (11:44 -0800)]
Remove @KnownFailure from a bunch of tests that now pass.

Looks like we got some of our Locales back.

14 years agoImplement chaining up to the first 64 cases in a switch statement.
Ben Cheng [Thu, 29 Oct 2009 21:39:18 +0000 (14:39 -0700)]
Implement chaining up to the first 64 cases in a switch statement.

14 years agoBack out inline string optimizations until cause of instability tracked down.
Bill Buzbee [Tue, 3 Nov 2009 16:06:02 +0000 (08:06 -0800)]
Back out inline string optimizations until cause of instability tracked down.

14 years agoEnsure dalvikvm sets "user.name" to "root" for our tests.
Elliott Hughes [Tue, 3 Nov 2009 02:16:19 +0000 (18:16 -0800)]
Ensure dalvikvm sets "user.name" to "root" for our tests.

dalvikvm sets "user.name" to $USER, but that environment variable isn't set
when we run the tests. I was looking at our DatagramSocketTest failure, and
it turns out it's another instance of "root can do stuff other users can't".
The typical way harmony tests check whether they're running as root is to
compare "user.name" against "root", but from run-core-tests they see "".

14 years agoMerge change I22212019
Android (Google) Code Review [Tue, 3 Nov 2009 00:51:25 +0000 (19:51 -0500)]
Merge change I22212019

* changes:
  Kill OSNetworkSystem.inheritedChannelImpl.

14 years agoMerge change I57dd1032
Android (Google) Code Review [Mon, 2 Nov 2009 23:35:57 +0000 (18:35 -0500)]
Merge change I57dd1032

* changes:
  Supporting expected results for the jtreg test runner.

14 years agoMerge change Ie098e2fa
Android (Google) Code Review [Mon, 2 Nov 2009 23:32:38 +0000 (18:32 -0500)]
Merge change Ie098e2fa

* changes:
  Fixing PipedWriters/PipedOutputStreams silent failures during close().

14 years agoKill OSNetworkSystem.inheritedChannelImpl.
Elliott Hughes [Mon, 2 Nov 2009 23:25:05 +0000 (15:25 -0800)]
Kill OSNetworkSystem.inheritedChannelImpl.

This code is broken (and more broken than upstream), and not obviously relevant
to our platform. Let's make it clear that all this currently does is return
null.

The changes in the Java side bring us back in sync with upstream.

14 years agoFixing PipedWriters/PipedOutputStreams silent failures during close().
Jesse Wilson [Mon, 2 Nov 2009 21:58:26 +0000 (13:58 -0800)]
Fixing PipedWriters/PipedOutputStreams silent failures during close().

See bug 2224903 and jtreg test java.io.BufferedWriter.Cleanup.

14 years agoMerge change I04f3b02b
Android (Google) Code Review [Mon, 2 Nov 2009 22:51:29 +0000 (17:51 -0500)]
Merge change I04f3b02b

* changes:
  Jit - optimized inline string compareto, indexof; fill_array_data bug fix

14 years agoSome more adjustments to deal with building for a BSD(-like) target.
Dan Bornstein [Thu, 29 Oct 2009 17:15:42 +0000 (10:15 -0700)]
Some more adjustments to deal with building for a BSD(-like) target.

Change-Id: I5e33c3db160ae3af6e324492e0b6a7a0dfb9719b

14 years agoMerge change I318b1449
Android (Google) Code Review [Mon, 2 Nov 2009 21:33:43 +0000 (16:33 -0500)]
Merge change I318b1449

* changes:
  More OSNetworkSystem cleanup.

14 years agoMore OSNetworkSystem cleanup.
Elliott Hughes [Sat, 31 Oct 2009 00:54:32 +0000 (17:54 -0700)]
More OSNetworkSystem cleanup.

valgrind didn't like what we were doing here, specifically the way we
were setting ss_family to AF_INET if getsockopt IP_MULTICAST_IF didn't
return an AF_INET address, and ignoring the fact that the rest of
the sockaddr_storage doesn't necessarily correspond to an AF_INET address.
Linux seems to return an AF_UNSPEC address (rather than INADDR_ANY) if we
haven't set a multicast interface, so we have to do the conversion ourselves.

More disturbingly (and unfixed by this patch) we sometimes see ss_family
come back as 127 (when AF_MAX is 32 on our system). My guess is that the
kernel is just handing back bad data we gave it earlier, but I'll come back
to see about fixing multicast properly later.

I've inlined socketAddressToString into osNetworkSystem_byteArrayToIpString,
its only caller, because it's clearer that way now we've simplified the
division of error handling between the two.

I've brought getSocketLocalAddressImpl and getSocketLocalPortImpl in line
with each other and changed them to at least log errors. I've also added
a new test that fails, to demonstrate that this implementation is broken
as designed.

I've changed the name of JAVASOCKOPT_IP_MULTICAST_IF to match the Java
constant.

I've fixed the exception we throw if we're asked to convert a bad address
family's address from code that can't throw IOException --- AssertionError
doesn't have a String constructor. Really, we need to kill this code, so
I've added a TODO.

I've also made a real push to get rid of most of the SOCKERR_*-based error
reporting. (I had a transient failure with a meaningless error message
that sent me to the source to work out which errno it was actually
trying to report.)

I've changed setTTL to call setTimeToLive, and change the implementation
of the latter to pass Integer rather than Byte to the native implementation,
since that's what the native code needs anyway and native Byte support was
only for TTL.

Bug: 2225748

14 years agoJit - optimized inline string compareto, indexof; fill_array_data bug fix
Bill Buzbee [Mon, 2 Nov 2009 17:23:49 +0000 (09:23 -0800)]
Jit - optimized inline string compareto, indexof; fill_array_data bug fix

Added flushAllRegs() prior to C handlers in preparation for upcoming support
for holding live/dirty values in physical registers.

14 years agoSupporting expected results for the jtreg test runner.
Jesse Wilson [Fri, 30 Oct 2009 23:53:05 +0000 (16:53 -0700)]
Supporting expected results for the jtreg test runner.

This is necessary to suppress false positives when dalvik
intentionally differs from the RI. This came up in the fix
for issue 2224903.

Also adding additional features to the jtreg runner to make
it useful as an iterative development tool:
 - debugger support, to debug through running tests
 - verbose output, to aid in diagnosing hangs

Also adding a few ".expected" files for known test failures.
Hopefully this is scalable.

Renaming Run to TestRun and extracting Result as a top-level enum.

14 years agoMerge change I88e8376e
Android (Google) Code Review [Mon, 2 Nov 2009 04:47:27 +0000 (23:47 -0500)]
Merge change I88e8376e

* changes:
  Update logging to r820767

14 years agoMerge change Id46d9a48
Android (Google) Code Review [Sat, 31 Oct 2009 17:32:13 +0000 (13:32 -0400)]
Merge change Id46d9a48

* changes:
  Fixing 1 of the 4 BufferedReader test failures in bug 2224903.

14 years agoFixing 1 of the 4 BufferedReader test failures in bug 2224903.
Jesse Wilson [Fri, 30 Oct 2009 01:36:38 +0000 (18:36 -0700)]
Fixing 1 of the 4 BufferedReader test failures in bug 2224903.

This CL includes the following functional changes:
 - changing read to not clear the mark upon reading EOF
 - changing read(char[], int, int) to use the 'read
   directly from the source stream' shortcut when the
   mark has exceeded its limit. Previously we took the
   shortcut only when the mark was unset.

And these nonfunctional changes
 - rewrote read(char[], int, int) dramatically. The new
   revision contains only one call to 'System.arrayCopy'
   and the related bookkeeping. Previously there was one call
   before the loop, and another call in the loop.
 - renamed markpos to mark
 - renamed marklimit to markLimit
 - renamed count to end (it isn't a count, it's a position)
 - simplifying conditions that used >= when > was impossible
 - reducing the number of field reads where convenient

14 years agoMerge change I474dc860
Android (Google) Code Review [Fri, 30 Oct 2009 22:29:32 +0000 (18:29 -0400)]
Merge change I474dc860

* changes:
  Rewrite NativeBN_twosCompFitsIntoBytes.

14 years agoFixed typo introduced during comment reformatting.
Bill Buzbee [Fri, 30 Oct 2009 22:00:52 +0000 (15:00 -0700)]
Fixed typo introduced during comment reformatting.

14 years agoMerge change Ib000d44f
Android (Google) Code Review [Fri, 30 Oct 2009 21:37:44 +0000 (17:37 -0400)]
Merge change Ib000d44f

* changes:
  Major registor allocation rework - stage 1.

14 years agoMajor registor allocation rework - stage 1.
Bill Buzbee [Thu, 24 Sep 2009 00:17:35 +0000 (17:17 -0700)]
Major registor allocation rework - stage 1.

Direct usage of registers abstracted out.
Live values tracked locally.  Redundant loads and stores suppressed.
Address of registers and register pairs unified w/ single "location" mechanism
Register types inferred using existing dataflow analysis pass.
Interim (i.e. Hack) mechanism for storing register liveness info. Rewrite TBD.
Stubbed-out code for linear scan allocation (for loop and long traces)
Moved optimistic lock check for monitor-enter/exit inline for Thumb2
Minor restructuring, renaming and general cleanup of codegen
Renaming of enums to follow coding convention
Formatting fixes introduced by the enum renaming

Rewrite of RallocUtil.c and addition of linear scan to come in stage 2.

14 years agoRewrite NativeBN_twosCompFitsIntoBytes.
Elliott Hughes [Fri, 30 Oct 2009 06:06:37 +0000 (23:06 -0700)]
Rewrite NativeBN_twosCompFitsIntoBytes.

valgrind complains about invalid 4-byte reads, caused by "case 8" in the
BNInterface.c function I'm removing here, which assumed that if we're checking
whether a BIGNUM fits in 8 bytes, it must require more than 4 bytes (and so
accessing d[1] is acceptable).

We can implement this in Java using the existing BigInteger.bitLength
method (which may call down to native code, but that native code looks okay).

Also remove a related commented-out method.

Bugs: 22232132225642

14 years agoMerge change I006c279b
Android (Google) Code Review [Thu, 29 Oct 2009 22:01:56 +0000 (18:01 -0400)]
Merge change I006c279b

* changes:
  Remove broken .so and fix bogus test.

14 years agoRemove broken .so and fix bogus test.
Elliott Hughes [Thu, 29 Oct 2009 21:02:57 +0000 (14:02 -0700)]
Remove broken .so and fix bogus test.

valgrind doesn't like this because the .so *only* exists for x86 (contrary to
the claim in the @AndroidOnly annotation) but it's broken there, returning
a char* instead of a jstring.

I'm not really sure what they were trying to test here, but let's assume it
was that Runtime.getRuntime().load behaves like System.load, and fix the
tests that way.

Bug: 2223234

14 years agoMerge change I4a356627
Android (Google) Code Review [Thu, 29 Oct 2009 18:38:23 +0000 (14:38 -0400)]
Merge change I4a356627

* changes:
  Change the jtreg tool to perform both building and running steps.

14 years agoMerge change I8fa1a78a
Android (Google) Code Review [Thu, 29 Oct 2009 00:49:00 +0000 (20:49 -0400)]
Merge change I8fa1a78a

* changes:
  Make run-core-tests with no arguments equivalent to tests.AllTests.

14 years agoChange the jtreg tool to perform both building and running steps.
Jesse Wilson [Thu, 29 Oct 2009 00:36:00 +0000 (17:36 -0700)]
Change the jtreg tool to perform both building and running steps.

14 years agoMake run-core-tests with no arguments equivalent to tests.AllTests.
Elliott Hughes [Wed, 28 Oct 2009 23:19:48 +0000 (16:19 -0700)]
Make run-core-tests with no arguments equivalent to tests.AllTests.

Previous behavior would run the same set of tests, but without going through
the regular pre- and post-processing, and without initializing the command-line
flags to their default values.

14 years agoMerge change Id7694644
Android (Google) Code Review [Wed, 28 Oct 2009 22:07:59 +0000 (18:07 -0400)]
Merge change Id7694644

* changes:
  Script for compiling and dexing jtreg tests for Dalvik.

14 years agoScript for compiling and dexing jtreg tests for Dalvik.
Jesse Wilson [Wed, 28 Oct 2009 00:08:33 +0000 (17:08 -0700)]
Script for compiling and dexing jtreg tests for Dalvik.

14 years agoMerge change I8c671e53
Android (Google) Code Review [Wed, 28 Oct 2009 20:25:36 +0000 (16:25 -0400)]
Merge change I8c671e53

* changes:
  Implement ProcessBuilder.redirectErrorStream.

14 years agoImplement ProcessBuilder.redirectErrorStream.
Elliott Hughes [Tue, 27 Oct 2009 20:39:09 +0000 (13:39 -0700)]
Implement ProcessBuilder.redirectErrorStream.

Also simplify and correct the security to ensure that the user can't modify
the command to be executed after the SecurityManager has approved it.

Bug: 2180063

14 years agoFix a few FindBugs warnings in code that isn't upstream.
Elliott Hughes [Tue, 27 Oct 2009 23:53:15 +0000 (16:53 -0700)]
Fix a few FindBugs warnings in code that isn't upstream.

Bugs: 20996422099637

14 years agoUpdate logging to r820767
Jesse Wilson [Tue, 27 Oct 2009 00:49:25 +0000 (17:49 -0700)]
Update logging to r820767

14 years agoRemove OSNetworkSystem.sendStream and all use of ErrorCodeException.
Elliott Hughes [Mon, 26 Oct 2009 23:38:13 +0000 (16:38 -0700)]
Remove OSNetworkSystem.sendStream and all use of ErrorCodeException.

Removing OSNetworkSystem.sendStream brings us in line with harmony. I've
also rewritten writeSocketImpl to not make a temporary copy of the data it's
going to send.

The weird code in writeSocketDirectImpl that threw ErrorCodeException turns out
to be a very awkward way of returning zero to the only two callers that are
paying attention. (Harmony actually calls the equivalent of this code every
time it throws SocketException from native code, but these two callers were
the only places that checked for the special case.)

14 years agoThe officially sanctioned way to get memcpy() is to #include <string.h>.
Dan Bornstein [Mon, 26 Oct 2009 23:30:39 +0000 (16:30 -0700)]
The officially sanctioned way to get memcpy() is to #include <string.h>.

Change-Id: Ie157d9305df5f9b86a09ea2224666fd2c054cda4

14 years agoMerge change I4c4d050d
Android (Google) Code Review [Mon, 26 Oct 2009 22:41:14 +0000 (18:41 -0400)]
Merge change I4c4d050d

* changes:
  Clone TEMP_FAILURE_RETRY in JNIHelp.h, to make up for (take your pick) laggard libc implementations not keeping up with the times or (perhaps) agressively modern libc implementations too eagerly expanding upon the standard.

14 years agoMerge change Ibc04ef43
Android (Google) Code Review [Mon, 26 Oct 2009 21:09:10 +0000 (17:09 -0400)]
Merge change Ibc04ef43

* changes:
  Remove dead native org.apache.harmony.nio.AddressUtils code.

14 years agoClone TEMP_FAILURE_RETRY in JNIHelp.h, to make up for (take your pick)
Dan Bornstein [Mon, 26 Oct 2009 20:33:22 +0000 (13:33 -0700)]
Clone TEMP_FAILURE_RETRY in JNIHelp.h, to make up for (take your pick)
laggard libc implementations not keeping up with the times or
(perhaps) agressively modern libc implementations too eagerly
expanding upon the standard.

Change-Id: I4c4d050d15a00f4e82f8beb2b9c386b7c652f495

14 years agoRemove dead native org.apache.harmony.nio.AddressUtils code.
Elliott Hughes [Mon, 26 Oct 2009 20:14:07 +0000 (13:14 -0700)]
Remove dead native org.apache.harmony.nio.AddressUtils code.

This code is dead at the moment, and were it ever to become live, I'm pretty
sure we'd want to start again from scratch rather than do whatever the author
of this had in mind.

14 years agoMerge change I8a7a4c56
Android (Google) Code Review [Mon, 26 Oct 2009 19:14:26 +0000 (15:14 -0400)]
Merge change I8a7a4c56

* changes:
  Split libcore/Android.mk into two files, one for Java code and one for native code, and make each have a set of rules for building on the host.

14 years agoMerge change Ibebb78b6
Android (Google) Code Review [Mon, 26 Oct 2009 18:50:11 +0000 (14:50 -0400)]
Merge change Ibebb78b6

* changes:
  Switch ProcessManager and System over to C++.

14 years agoDeleteLocalRef the result of GetObjectClass more consistently.
Elliott Hughes [Mon, 26 Oct 2009 18:18:00 +0000 (11:18 -0700)]
DeleteLocalRef the result of GetObjectClass more consistently.

Should fix VM crashes in tests.java.sql.StressTest, which can now be
re-enabled.

I've also added a "throwoom" to the one place where this code
calls malloc but doesn't check the result.

Bug: 2213053

14 years agoSplit libcore/Android.mk into two files, one for Java code and one for
Dan Bornstein [Sat, 24 Oct 2009 22:33:49 +0000 (15:33 -0700)]
Split libcore/Android.mk into two files, one for Java code and one for
native code, and make each have a set of rules for building on the host.

I also tightened up how sub.mk processing works and documented it
a little better.

Change-Id: I8a7a4c5697b2f22c4d69941dba381d6452200911

14 years agoMerge change I66e35647
Android (Google) Code Review [Mon, 26 Oct 2009 17:04:31 +0000 (13:04 -0400)]
Merge change I66e35647

* changes:
  A new hygenic way for tests to clean up before or after execution.

14 years agoA new hygenic way for tests to clean up before or after execution.
Jesse Wilson [Fri, 23 Oct 2009 22:31:41 +0000 (15:31 -0700)]
A new hygenic way for tests to clean up before or after execution.

This replaces PrefsTester and is more general purpose.

14 years agoMerge change I968363e2
Android (Google) Code Review [Mon, 26 Oct 2009 05:06:43 +0000 (01:06 -0400)]
Merge change I968363e2

* changes:
  Suppressing StressTest which is causing our continuous build to fail.

14 years agoSuppressing StressTest which is causing our continuous build to fail.
Jesse Wilson [Sun, 25 Oct 2009 18:00:06 +0000 (11:00 -0700)]
Suppressing StressTest which is causing our continuous build to fail.

We're tracking this under issue 2213053.

14 years agoMerge change Ibf565c9c
Android (Google) Code Review [Sat, 24 Oct 2009 21:39:51 +0000 (17:39 -0400)]
Merge change Ibf565c9c

* changes:
  Change the host build to include whole static libraries, and to name them "*-host".

14 years agoChange the host build to include whole static libraries, and to name
Dan Bornstein [Sat, 24 Oct 2009 20:23:37 +0000 (13:23 -0700)]
Change the host build to include whole static libraries, and to name
them "*-host".

Change-Id: Ibf565c9c4b0709eb25edd71786b269895a1616a4

14 years agoSwitch ProcessManager and System over to C++.
Elliott Hughes [Sat, 24 Oct 2009 01:10:44 +0000 (18:10 -0700)]
Switch ProcessManager and System over to C++.

Bug 2180063 will require changes to ProcessManager, so now's a good time
to make the switch in this directory.

14 years agoMerge change I410514c5
Android (Google) Code Review [Sat, 24 Oct 2009 00:33:11 +0000 (20:33 -0400)]
Merge change I410514c5

* changes:
  Expose hooks for more efficient log handling in Android apps.

14 years agoSort out libnativehelper, and make related comments less redundant.
Dan Bornstein [Fri, 23 Oct 2009 20:25:03 +0000 (13:25 -0700)]
Sort out libnativehelper, and make related comments less redundant.

Change-Id: If25babc7b3232449a3ba8503431865273d4f481a

14 years agoMerge change I3628c655
Android (Google) Code Review [Fri, 23 Oct 2009 19:20:02 +0000 (15:20 -0400)]
Merge change I3628c655

* changes:
  OSMemorySystem.mmap fixes.

14 years agoMerge change I834d8b2c
Android (Google) Code Review [Fri, 23 Oct 2009 19:13:13 +0000 (15:13 -0400)]
Merge change I834d8b2c

* changes:
  Remove OSNetworkSystem.receiveStream.

14 years agoMerge change Idb16cc7f
Android (Google) Code Review [Fri, 23 Oct 2009 14:35:22 +0000 (10:35 -0400)]
Merge change Idb16cc7f

* changes:
  Add a reference table dump call.

14 years agoExpose hooks for more efficient log handling in Android apps.
Jesse Wilson [Wed, 21 Oct 2009 22:44:25 +0000 (15:44 -0700)]
Expose hooks for more efficient log handling in Android apps.

This change introduces a new interface, DalvikLogHandler. Log
handlers that implement it opt-in to more efficient log handling
for common-case log messages. The API requires far fewer objects
to be allocated to log a message.

A related change in frameworks/base adopts this optimization
in the built-in AndroidHandler.

This optimization resulted in a 2.75x improvement on my device:
from 154ns to 56ns per message.

14 years agoMerge change I93fe0d1b
Android (Google) Code Review [Fri, 23 Oct 2009 01:27:41 +0000 (21:27 -0400)]
Merge change I93fe0d1b

* changes:
  Re-enable SSL handshake cutthrough support (and fixed unittest)

14 years agoAdd a reference table dump call.
Andy McFadden [Fri, 23 Oct 2009 00:24:45 +0000 (17:24 -0700)]
Add a reference table dump call.

This adds a hidden method to android.os.Debug that causes the contents
of various reference tables to be dumped.  Currently it's the local,
global, and pinned array tables from JNI.

Bug 2075355

14 years agoOSMemorySystem.mmap fixes.
Elliott Hughes [Fri, 23 Oct 2009 00:25:01 +0000 (17:25 -0700)]
OSMemorySystem.mmap fixes.

Stop silently truncating the arguments to mmap. Check they're actually valid.

Fix mmap to actually throw IOException on error, as it claimed to do.

Correct parameter name 'alignment' to 'offset'.

Remove dead code (getPageSize).

14 years agoMerge change Ia1dc94d5
Android (Google) Code Review [Thu, 22 Oct 2009 23:59:10 +0000 (19:59 -0400)]
Merge change Ia1dc94d5

* changes:
  Encode recommended practice wrt libffi in comments, and attempt to actually follow those recommendations.

14 years agoRemove OSNetworkSystem.receiveStream.
Elliott Hughes [Thu, 22 Oct 2009 00:09:13 +0000 (17:09 -0700)]
Remove OSNetworkSystem.receiveStream.

Harmony removed this some time ago, and -- if we change our read/readDirect
implementations slightly -- we can too.

I've also added some bounds checking in the Java so we don't ask native code
to perform a buffer overrun for us.

I've also rewritten the native readSocketImpl to use GetByteArrayElements and
ReleaseByteArrayElements rather than its own custom stack/heap allocation and
arbitrary 64KiB limit. (As far as I can tell from the harmony history, the
limit dates from when they always read into an on-stack buffer, and was never
removed.)

I've also brought us in line with harmony so we only pass 'address' to
readDirect, rather than 'address' and 'offset'.

I've changed SocketTest to match upstream and -- since they pulled out some
of the tests into a new file -- I've added their UnixSocketTest so we don't
miss out. Our old SocketTest's test_getInputStream is the only test my new
code doesn't pass, but I think the old SocketTest was broken and the new
SocketTest/UnixSocketTest is correct.

I've also brought us back into line with harmony's MulticastSocketTest. With
the up-to-date tests, the new code behaves the same as the old code. (With
our old tests, the new code fails the joinGroup test with a
NullPointerException instead of a junit comparison failure.)

14 years agoEncode recommended practice wrt libffi in comments, and attempt to actually
Dan Bornstein [Thu, 22 Oct 2009 22:58:32 +0000 (15:58 -0700)]
Encode recommended practice wrt libffi in comments, and attempt to actually
follow those recommendations.

Change-Id: Ia1dc94d50158e322d4dc96fc8528c408f2a3be1c

14 years agoFix for unmatched entry/exit points in test traces
Rodrigo Ipince [Thu, 22 Oct 2009 20:21:02 +0000 (13:21 -0700)]
Fix for unmatched entry/exit points in test traces

Added support for the creation of test traces with unmatched entries/exits (current implementation segfaulted in some cases)

14 years agoRe-enable SSL handshake cutthrough support (and fixed unittest)
Nagendra Modadugu [Thu, 22 Oct 2009 17:23:58 +0000 (10:23 -0700)]
Re-enable SSL handshake cutthrough support (and fixed unittest)

14 years agoMerge change Ibeb7d4a2
Android (Google) Code Review [Thu, 22 Oct 2009 17:55:38 +0000 (13:55 -0400)]
Merge change Ibeb7d4a2

* changes:
  Cleaning up synchronization in Logger.

14 years agoCleaning up synchronization in Logger.
Jesse Wilson [Wed, 21 Oct 2009 21:57:48 +0000 (14:57 -0700)]
Cleaning up synchronization in Logger.

Formerly any logged message would require synchronization on the shared
global lock to access the root logger's handlers. This change replaces
synchronization on loggers with a combination of copy-on-write and
volatile fields.

Also moving handler initialization from lazy to eager - the code has
moved from initHandlers() to setManager().

Also tidying up the info(), severe() type methods to delegate to avoid
unnecessary duplication.

14 years agoMerge change I3d8565f0
Android (Google) Code Review [Thu, 22 Oct 2009 14:34:55 +0000 (10:34 -0400)]
Merge change I3d8565f0

* changes:
  Collation.getSortKey returns keys generated by a different algorithm

14 years agoMerge change I5ea630ca
Android (Google) Code Review [Thu, 22 Oct 2009 14:22:32 +0000 (10:22 -0400)]
Merge change I5ea630ca

* changes:
  Use a binary search for sparse switch statements.

14 years agoMerge change Id1f4cf7b
Android (Google) Code Review [Thu, 22 Oct 2009 14:19:51 +0000 (10:19 -0400)]
Merge change Id1f4cf7b

* changes:
  Clear pending exception before throwing a new one.

14 years agoUse a binary search for sparse switch statements.
Andy McFadden [Wed, 21 Oct 2009 23:59:31 +0000 (16:59 -0700)]
Use a binary search for sparse switch statements.

Added a couple of edge cases to test 015.

For bug 2119870.

14 years agoClear pending exception before throwing a new one.
Andy McFadden [Wed, 21 Oct 2009 22:36:48 +0000 (15:36 -0700)]
Clear pending exception before throwing a new one.

The JNI helper function that throws an exception calls FindClass, which
isn't allowed if an exception is currently pending.  Some of our code
called this when an operation failed without noting that the thing that
failed already threw an exception; this caused the VM to blow up in a
rather unhelpful way.

We now log the class name and optional message from the original
exception, clear it, and then allocate & throw the new one.

For bug 2141867.

14 years agoMerge change Id434c469
Android (Google) Code Review [Wed, 21 Oct 2009 20:05:07 +0000 (16:05 -0400)]
Merge change Id434c469

* changes:
  More OSNetworkSystem cleanup.

14 years agoMore OSNetworkSystem cleanup.
Elliott Hughes [Wed, 21 Oct 2009 05:58:23 +0000 (22:58 -0700)]
More OSNetworkSystem cleanup.

Rewrite OSNetworkSystem.connect in terms of connectStreamWithTimeoutSocketImpl
in Java rather than in native code. Remove OSNetworkSystem.connectSocketImpl.
Make INetworkSystem.connect void, since the return value is always 0.

Use TEMP_FAILURE_RETRY rather than explicit do loops to retry interrupted
system calls.

Fix peekDatagramImpl to actually update the byte[] in the passed-in
InetAddress.

Stop pulling the int fd out of the FileDescriptor each time round the loop
in sendStreamImpl and sendDatagramImpl2.

More tiny steps towards eliminating the SOCKERR_ nonsense in favor of errno.

Prefer sizeof(variable) to sizeof(type).

Remove a few more superfluous "struct" keywords.

14 years agoMerge change Iacd79b8a
Android (Google) Code Review [Wed, 21 Oct 2009 16:53:08 +0000 (12:53 -0400)]
Merge change Iacd79b8a

* changes:
  Avoid shadowing fields from the superclass testcase.

14 years agoAvoid shadowing fields from the superclass testcase.
Jesse Wilson [Wed, 21 Oct 2009 01:49:47 +0000 (18:49 -0700)]
Avoid shadowing fields from the superclass testcase.

14 years agoMerge change I54b596ca
Android (Google) Code Review [Wed, 21 Oct 2009 01:10:03 +0000 (21:10 -0400)]
Merge change I54b596ca

* changes:
  Expose the portable "strerror_r" used by jniThrowIOException.

14 years agoExpose the portable "strerror_r" used by jniThrowIOException.
Elliott Hughes [Tue, 20 Oct 2009 23:59:01 +0000 (16:59 -0700)]
Expose the portable "strerror_r" used by jniThrowIOException.

Also add one example caller I used to test this, and update the
libnativehelper README file.

14 years agoMerge change Ib28d3a82
Android (Google) Code Review [Tue, 20 Oct 2009 23:13:32 +0000 (19:13 -0400)]
Merge change Ib28d3a82

* changes:
  Don't over flush the code cache at startup time.

14 years agoDon't over flush the code cache at startup time.
Ben Cheng [Tue, 20 Oct 2009 22:57:28 +0000 (15:57 -0700)]
Don't over flush the code cache at startup time.

Suspected that the kernel is having issues flushing cachelines for mmapped
pages that haven't been written to.

14 years agoMerge change Iadbb9163
Android (Google) Code Review [Tue, 20 Oct 2009 22:25:32 +0000 (18:25 -0400)]
Merge change Iadbb9163

* changes:
  Implement JNI "weak global" references.

14 years agoMerge change Ia8e64a7c
Android (Google) Code Review [Tue, 20 Oct 2009 20:31:38 +0000 (16:31 -0400)]
Merge change Ia8e64a7c

* changes:
  Fix an invoke-interface bug that manifests itself with thread state warnings.

14 years agoMerge change I9b12eeb5
Android (Google) Code Review [Tue, 20 Oct 2009 20:24:27 +0000 (16:24 -0400)]
Merge change I9b12eeb5

* changes:
  Applying PrefsTester to PreferenceChangeEventTest to manage side effects.

14 years agoMerge change Id752d5fb
Android (Google) Code Review [Tue, 20 Oct 2009 20:23:45 +0000 (16:23 -0400)]
Merge change Id752d5fb

* changes:
  Including cert store location for test runner.

14 years agoFix an invoke-interface bug that manifests itself with thread state warnings.
Ben Cheng [Tue, 20 Oct 2009 20:01:36 +0000 (13:01 -0700)]
Fix an invoke-interface bug that manifests itself with thread state warnings.

r12 is a scratch register and apparently gcc 4.4 starts to actively use it in
dvmFindInterfaceMethodInCache, the very function that the original live value
is being protected around. This results in useless values setup in the chaining
cell and increases the chances to patch the cell (thus the suspend-all
requests).

Add verbose names for new JIT-related suspend reasons.

With all these changes, the thread state warning will still occur but much less
frequently.

bug 2194174.

14 years agoImplement JNI "weak global" references.
Andy McFadden [Fri, 25 Sep 2009 17:42:15 +0000 (10:42 -0700)]
Implement JNI "weak global" references.

The VM now supports the NewWeakGlobalRef and DeleteWeakGlobalRef calls,
which create a kind of weak reference that's directly visible to native
code.  While the JNI spec says that these can be used directly, the only
safe way to use them is to convert them to a strong local or global
reference first, so this is enforced.

The net result is very similar to manually creating a global reference to
a WeakReference object and manipulating it with method calls from native
code, but the JNI calls are faster and more convenient.

14 years agoIncluding cert store location for test runner.
Jesse Wilson [Tue, 20 Oct 2009 18:13:20 +0000 (11:13 -0700)]
Including cert store location for test runner.

This helps to avoid bad interactions between tests that rely
on the "java.home" property for different things. Preferences
tests tend to change it (to the writable temp directory), but
the certs tests fall back to it for the trust store.

See also TrustManagerFactoryImpl.java.

14 years agoAnother couple of tweaks in my attempt to make a sane host build.
Dan Bornstein [Fri, 16 Oct 2009 17:51:23 +0000 (10:51 -0700)]
Another couple of tweaks in my attempt to make a sane host build.

Change-Id: I49938c6aa933cca19874432b127ad9b1b49e3e79

14 years agoApplying PrefsTester to PreferenceChangeEventTest to manage side effects.
Jesse Wilson [Tue, 20 Oct 2009 17:46:25 +0000 (10:46 -0700)]
Applying PrefsTester to PreferenceChangeEventTest to manage side effects.

14 years agoMerge change I73fd1714
Android (Google) Code Review [Tue, 20 Oct 2009 16:14:41 +0000 (12:14 -0400)]
Merge change I73fd1714

* changes:
  Fix OSNetworkSystem.acceptImpl error handling; additional clean-up.

14 years agoCollation.getSortKey returns keys generated by a different algorithm
Urs Grob [Tue, 8 Sep 2009 18:13:49 +0000 (20:13 +0200)]
Collation.getSortKey returns keys generated by a different algorithm

This test tested implementation details. This change makes the test only check specified behavior.

Note: The resulting key is incompatible with a key returned by the RI. that's the downside of using icu.
But there's also an upside: ICU compresses the sorting key that gets returned. This increases performance
when comparing the keys.

BUG=1635900

14 years agoMerge change I7cc0fe4d
Android (Google) Code Review [Tue, 20 Oct 2009 07:08:44 +0000 (03:08 -0400)]
Merge change I7cc0fe4d

* changes:
  rightsize StringBuilders for arrays; see bug 2135223