History log of /libcore/luni/src/main/native/Register.cpp
Revision Date Author Comments
7cd6760f7045d771faae8080a8c6150bf678f679 04-May-2012 Elliott Hughes <enh@google.com> Make libjavacore independent of libnativehelper for the PDK.

Bug: 6369821
Change-Id: Ie038571a5dac1f301c0c3c6fb84df432e67b62c0
679cf68b607e9b4a3beb8bcdee06868ae583386f 08-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: I3deb0b1b71cf4ec6d82921a2e0015c3a7b397cbf
dc915c69ba2495dd2cf965d16058d0b13762142c 20-May-2011 Elliott Hughes <enh@google.com> Move the floating-point parsing code, and tidy up some documentation.

Change-Id: Ibdc1716847f4c6a85a7c24766feffc8768819cef
553d98af897f7202de5e5a776287de0b5ca8fe39 19-May-2011 Elliott Hughes <enh@google.com> Expose accept(2).

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
e27d02044ec399884bfd4343d513bf270b9b9b11 16-May-2011 Elliott Hughes <enh@google.com> Remove OSNetworkSystem.close.

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
1c039d71d3879f39e3a75b8788e656f7b4f88f08 05-May-2011 Elliott Hughes <enh@google.com> Add getaddrinfo(2).

This only supports the "node" side of getaddrinfo(2), not the "service" side.
There's also no support for AI_CANONNAME, so we currently return InetAddress[]
rather than anything equivalent to C's linked list of struct addrinfo.

Bug: 3107501
Change-Id: I8cf6baa3027a0fa05ac6e2f8fcc1dd8b576ff8c4
52467225e3b1ff2386ed5bf630e97e5345469260 23-Apr-2011 Elliott Hughes <enh@google.com> Move JNIHelp's implementation to C++.

Change-Id: I110615696e8348e0dc3cf4a53726a5e0595f5d7e
a37e971343883bb582a93ffbd9f0ba84f10e55ba 21-Apr-2011 Elliott Hughes <enh@google.com> Rewrite NetworkInterface.

This is part of the POSIX work, but also fixes a bug that asked for down
interfaces to be returned. Additionally, I found a few bugs while rewriting
this code. Most notably, we used to return a bogus broadcast address for
the loopback interface. The only difference I notice between us and the RI
when running on the host is that the RI claims that 127.0.0.1 has a prefix
length of 0 rather than 8. I believe that we are correct on this issue.

Bug: 4082343, 3107501
Change-Id: I677e0698e3a86676b4332b5d56fe514a99c3ddc0
462bdac45c10f43d88d8f07f6994e272a27c14a2 30-Mar-2011 Elliott Hughes <enh@google.com> Add close(2).

This is sufficient for non-socket fds, but may need to change to support the
asynchronous socket close monitor. (Hopefully not; I'd rather lift that into
Java.)

I've also changed the semantics of IoUtils.close to match those desired by
all callers: ignore null/invalid FileDescriptors.

Bug: 3107501
Change-Id: Iad5c31c8f0f34d2a5ab1ed4581509b46af28bd1f
8b15dcc5890963edad4dfcf558cc16027c7985e5 29-Mar-2011 Elliott Hughes <enh@google.com> Add sendfile(2).

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
52724d3ebd4ccaaa4b9f5576e329d4272cde8ea9 17-Mar-2011 Elliott Hughes <enh@google.com> Add fsync(2) and fdatasync(2).

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
ec617e2cb4a374f0fd8fbda4a633214cf23a59a9 17-Mar-2011 Elliott Hughes <enh@google.com> Move the getenv(3) native code out of System as a demo.

This is a fairly trivial patch, just to show the general structure.

Bug: 3107501
Change-Id: I547df621ccb8b8874e5f74c4d0bcf84ccaef97c3
cdf7a1f942469221bcfd63d9cdf71851b011eaf0 16-Mar-2011 Elliott Hughes <enh@google.com> Expose POSIX constants.

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
f934c3d2c8dd9e6bc5299cef41adace2a671637d 15-Mar-2011 Elliott Hughes <enh@google.com> Make OSMemory the semi-supported libcore.io.Memory.

Looks like we're not going to bother with a separate libcore.os package,
when libcore.io will do.

Change-Id: I2806c59349ed4b6410d768c4207c384ced973c54
bb1c04167bdff1939e9e71ed04c57337d4951008 17-Feb-2011 Elliott Hughes <enh@google.com> Tidy up the bidi code a little.

If we do ever use this, we should probably kill the run class completely; we
don't expose it to callers, and we could easily cope with a simple int[]
internally.

Change-Id: Ic03fbf7e56251a35b5db31509fbca15ab6d6f01a
08343a4ef77616fc420e51d1095c0d6a266041ba 16-Feb-2011 Elliott Hughes <enh@google.com> Remove our implementations of inline natives.

It turns out that our String.equals was getting used. Making dalvikvm's inline
natives be native methods ensures that doesn't happen.

I've also added a test to ensure we explicitly test both variants.

Change-Id: Ie2a4b5289092da5ffca4a4273692f1048ab3b841
296b43d6f6fc96b0b4cf16956bebed8347953a6f 11-Feb-2011 Elliott Hughes <enh@google.com> Remove the obsolete TouchDex code.

Apparently, this is how we did the first-boot dexing before we had a
package manager.

Change-Id: I6fce0fb30ab9dc2e7ebb0c4177540e92677c92b9
b8f9285f7e67812c435bc429e07683d6b9039b0a 22-Dec-2010 Jesse Wilson <jessewilson@google.com> Revert "Remove inline natives for an unused performance test." (libcore)

Change-Id: I7ea69f84c008c5bdbdf8af6134fb81d80f0a958e
2c549add8659c3f53a4b7306d3a01262434383e9 22-Dec-2010 Jesse Wilson <jessewilson@google.com> Remove native targets for unused performance tests.

Change-Id: Ia61172cd52de031290a811c3ec73edb929f40c10
1ad1fe9aa7fa705ce4441e90f46cf790ad0f758a 22-Dec-2010 Ben Cheng <bccheng@android.com> Revert "Remove native targets for unused performance tests."

This reverts commit 272a383283a974a4c32a94469b8a8b021d93a480.
272a383283a974a4c32a94469b8a8b021d93a480 21-Dec-2010 Jesse Wilson <jessewilson@google.com> Remove native targets for unused performance tests.

See also change I5a252e31.

Change-Id: I3880a81f1f7e90247ce12860b5a2f597037123a7
6523532145f06d8c208ed7a9374d3ab6d8132e66 14-Dec-2010 Elliott Hughes <enh@google.com> More serialization performance improvements.

Cache more work and don't use a Map of Integers for a range of
integers that's defined to be dense, just because they don't start at 0.

Bug: http://code.google.com/p/android/issues/detail?id=13138
Change-Id: Ie73d0bb946892f86165fca78da10bbcf64322570
975dc421bdf9f207ed88b3fbedbba558f0f62c3c 10-Dec-2010 Stan Chesnutt <chesnutt@google.com> Adds new RawSocket class (and underlying jni implementation). This is a
utility class for an experimental Java implementation of dhcp. The client
DHCP implementation needs to construct, send, receive, and parse raw L2
packets before the network interface is configured with an IP address. Current
Java networking classes do not work with unconfigured network interfaces.

Change-Id: I4dd0133868da5b84bd2a471c33173d4c056c34e8
7d0d108593ac30e19b8f2a5a157f697f3f46c041 13-Nov-2010 Elliott Hughes <enh@google.com> Switch ObjectOutputStream over to reflection.

Reduces the amount of (native) code, and improves performance. I've also
improved some of the detail messages from the reflection code (to help in
my own debugging).

I'll do ObjectInputStream next...

Bug: 3158451
Change-Id: Icf06a17507f9d011d120f2d704e084a103a400c7
cfa6ffebf3a63db7a125c4d9abe7e661fac5cc1f 04-Oct-2010 Elliott Hughes <enh@google.com> More package-jiggling for our ICU-related code.

Bug: 3045778
Change-Id: Ia9b29b28512deca6bd9dad806468238f8db2a8b9
c27a366a89e470690e99374b15270e7b9169ade1 02-Oct-2010 Elliott Hughes <enh@google.com> More icu4jni reshuffling.

Bug: 3045778
Change-Id: Iafb367f97d1fb169c6106adad0525cfcc0e10f25
972d9be2dbbf6d467728b8ad44625f6574068bf8 17-Sep-2010 Elliott Hughes <enh@google.com> Explode early when ICU's .dat file isn't available.

Also make it generally more obvious (and more obvious who's to blame) when
libcore's native code fails to initialize.

Bug: 3005342
Change-Id: I75496bb0c15391d7f32ba50b9c488ea0480e3e42
706de1164836051ab31cc69eb77a6bba1a723896 27-Aug-2010 Elliott Hughes <enh@google.com> Minor tidy-up of Float.toString and Double.toString.

This patch looks larger than it is. I've moved duplicated constants out of
Math and StrictMath and into Float and Double where they belong. I've also
moved a table out of BigDecimal so I can reuse it in NumberConverter, which
I've renamed to RealToString.

The main active ingredient here is that there's no longer StringBuilder usage
to prepend '-'. This actually brings us down from 74ns to 62ns for an easy
case like 123.45f.

[cherry-pick of 910106e29fe98f14b2c36312a7498287273ba826 from dalvik-dev to gingerbread; plus build fix]

Bug: 2934304
Change-Id: Id79a6fb0d739e673b7428d240fc48bdae9b8bb43
910106e29fe98f14b2c36312a7498287273ba826 27-Aug-2010 Elliott Hughes <enh@google.com> Minor tidy-up of Float.toString and Double.toString.

This patch looks larger than it is. I've moved duplicated constants out of
Math and StrictMath and into Float and Double where they belong. I've also
moved a table out of BigDecimal so I can reuse it in NumberConverter, which
I've renamed to RealToString.

The main active ingredient here is that there's no longer StringBuilder usage
to prepend '-'. This actually brings us down from 74ns to 62ns for an easy
case like 123.45f.

Bug: 2934304
Change-Id: I65461753247eeb9ff890ffe66b0bc79d66d2ec9c
8510524dab13e0acc1babf22cbc55002fb122777 17-Aug-2010 Elliott Hughes <enh@google.com> Some nio tidying.

Remove indirection on OSMemory, and use public ByteOrder and MapMode types
throughout the implementation, rather than adding our own duplication. Also
remove some unnecessary Java methods that just forwarded to identical native
methods, and an unnecessary factory class for MappedByteBuffer instances.
Also get rid of ICommonDataTypes, most of which was unused cruft.

Change-Id: I3240b02bcc19941b1b1cbba351ae7f7c1cdfc5b4
99a89dd6f0a0e1396aa9b3feebf15ea31f703d3a 04-Aug-2010 Elliott Hughes <enh@google.com> Rewrite the nio Pipe to use a Unix pipe behind the scenes.

We were using an AF_INET or AF_INET6 socket to implement the nio Pipe, which
was causing trouble for people on systems where IPv6 wasn't working yet.

This patch switches over to pipe(2). My first implementation used socketpair(2)
and retained the SocketChannelImpls, but it still seemed a bit off to be asking
for a full-duplex pipe to implement a unidirectional channel, and it required
hacks in the networking code to cope with the AF_LOCAL family, and in the
BlockGuard for the isLingeringSocket test.

This implementation uses pipe(2) and FileChannelImpl. It breaks a few tests, but
the tests are wrong, and it actually brings us closer to the RI's behavior of
throwing IOException "broken pipe" when writing to a broken pipe.

Rather than keep throwing junk into the FileSystem/NetworkSystem classes, and
resolving the question of which of those setNonBlocking belonged in (answer:
neither; this is a false Windows-style dichotomy that isn't helpful here), I've
added a new IoUtils with a few generally useful methods. The remainder of this
patch switches over existing code. We could probably make
FileDescriptor.descriptor private now I've exposed accessors, but this change
is large enough already...

Bug: 2735373
Bug: http://code.google.com/p/android/issues/detail?id=9431
Change-Id: I6b6d1e50bdddd435e71c31105a73c9d4fd135d7e
dbbdffce5ac97a0e93ef495adaacca3660b9ab21 23-Jul-2010 Elliott Hughes <enh@google.com> Remove UCharacter's unnecessary layer of indirection.

Also fix this sim-eng build failure:

libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp: In function ‘jint OSMemory_flushImpl(JNIEnv*, _jobject*, jint, jlong)’:
libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp:334: error: invalid conversion from ‘const void*’ to ‘void*’
libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSMemory.cpp:334: error: initializing argument 1 of ‘int msync(void*, size_t, int)’

Change-Id: Ia23c9af79c690254179139072b84bd0a35f17fba
5cd6df2f627e06f9b7f714181d70d3148a3d6c60 01-Jul-2010 Elliott Hughes <enh@google.com> Part 2 of the "new String"/String.getBytes performance work.

I didn't plan on a part 2, but my benchmark was bogus. I'd failed to take into
account the fact that the ICU code (which I was comparing against) has a higher
intercept but lower slope than the Java I replaced it with. This new code
offers the best of both worlds: low intercept (start-up cost) and low slope
(per-byte/char cost).

The bad news is that this means I'm adding more native code. In addition to the
improved benchmark, I'll commit a benchmark that contains the pure Java
implementations so we can see when the JIT advances to the point that we can
retire this native code.

Change-Id: Ibac24c2e3deed216bd492acf2fac7554d3f96d85
12cd1f00c2fa1a7f37bf644cecdf7588bdc0b0a9 23-Jun-2010 Brian Carlstrom <bdc@google.com> Remove libcore's dependency on bouncycastle

external/bouncycastle
- Change to be the primary build for bouncycastle sources (as opposed to part of libcore)
- Moved OpenSSLMessageDigest from libcore to OpenSSLDigest
It uses NativeCrypto API from core, but implements a bouncycastle specific interface
- restored registration of bouncycastle MessageDigests for SHA-1, SHA-256, MD5
OpenSSLProvider versions take precedence, but explicit provider of "BC" allows choice
- enabled native versions of SHA-384 and SHA-512
- pruned MD4 implementation

frameworks/base
- frameworks and CoreTests modules now depend on bouncycastle
- update preloades classes for NativeBN package change
- moved CryptoTest to libcore

libcore
- core now builds without bouncycastle sources
- core-tests, core-tests-support, core-tests-supportlib now depend on bouncycastle
- removed libcore/openssl directory, moving NativeBN to java/math
- minor cleanup of Provider, Security, Services style while working on ProviderTest
- added new OpenSSLProvider registered as first provider to have
priority over the others to ensure our native implementations are used
- moved BouncyCastle to have priority as a provider over Harmony
- JarVerifier and JarUtils now implicitly use OpenSSLMessageDigest
- Cleanedup OpenSSLSignature, implementation needs to be finished to move to OpenSSLProvider
- To avoid using PEMWriter from BouncyCastle, NativeCrypto now takes binary encoded certs and keys
This is more efficient as well avoiding the base64 decode/encode of the binary data
- removed SHA-224 to match the RI

packages/apps/CertInstaller
- CertificateInstaller module now depends on bouncycastle
this is the only app to depend on bouncycastle

system/core
- updated BOOTCLASSPATH

Change-Id: I6205366b12baec4331b4a76e2c85d8324bf64b2c
e377c5a424823bacf28e8ffb2a2f02bfe46d4a2b 26-Jun-2010 Elliott Hughes <enh@google.com> Rewrite java.util.regex to use ICU's C++ API.

I've also removed a bunch of dead code and changed the interface to reduce the
number of JNI transitions. Error checking is more uniform, various special
cases have been removed, and we pass all the tests referenced by
libcore/luni/src/test/java/tests/regex/AllTests.java for the first time.

This should also be a stepping-stone to fixing http://b/2777924, removing the
need to copy the input string to the native heap.

Bug: 2587040
Change-Id: I62685a2384db441cd02df159e117187f3175e10d
21557bb6a8f35a2f9889adba449cac950c9d41b9 23-Jun-2010 Elliott Hughes <enh@google.com> Add TimeZones.forLocale, plus some tidying.

The new feature here is TimeZones.forLocale and the accompanying JNI. I've also
taken the liberty of pulling the time zone stuff out of ICU.java and ICU.cpp,
and I've moved some of the ICU-related code I've written recently (NativeIDN,
NativeNormalizer, and NativePluralRules) into a new libcore.icu package.

I've also renamed various things so the implementation details use the same
terminology as the thing they're implementing.

Bug: 2790386
Change-Id: Ie39a2f5f7023e8e29864de15790be8a660f5cba6
7775409378596fd980dbd576f9738d337bd8a76d 18-Jun-2010 Elliott Hughes <enh@google.com> Add support for ICU's PluralRules.

Note that this doesn't address the original submitter's complaint: ICU agrees
that zero isn't a special case in English. What this does is allow us to fix
getQuantityString to work with languages other than English and Czech (which
currently have hard-coded implementations in frameworks/base).

Bug: 2663392
Change-Id: I4cf80a61cd5183636381511d6b860d2059f788ee
f10b2437ae5ec073f8c4118f7235022ba83667c4 18-Jun-2010 Elliott Hughes <enh@google.com> Minor bidi tidying.

Fix the bidi code to consistently use finally blocks to ensure we can't
leak native UBidi objects. Rename BidiWrapper to NativeBidi since it isn't
a class with a finalizer that wraps a UBidi: it's just a namespace for static
native methods.

Also remove the useless public constructor from NativeCollation.

Bug: 2772065
Change-Id: I441ff4811bb66c37daf270d74d5403b9848cce90
74c50755c30b3afd4852e006aeedeb25232ca757 17-Jun-2010 Elliott Hughes <enh@google.com> Rewrite FileDescriptor and ProcessManager's JNI in terms of JNIHelp.h's API.

This lets us remove JniConstants::fileDescriptorClass and rely on the cached
jclass in JNIHelp.c.

Change-Id: Ie9b067113050e95413c28befe0143a8bbf2113de
a9f5c16a864ff63ba63f810410f8a27c086d5d52 17-Jun-2010 Elliott Hughes <enh@google.com> Remove dynamic calls to FindClass.

Initially, I was just fixing a threading bug in NativeDecimalFormat.cpp where
we were bypassing GCC's built-in static initializer thread safety. This led me
to the question of how expensive FindClass is, which led me to creating a new
canonical cache of jclasses.

Here's the motivating benchmark, showing the cost of calling an empty regular
(non-native) method, an empty native method, a native method that calls
FindClass, a native method that calls FindClass and GetFieldID, and a native
method that calls FindClass and GetMethodID:

benchmark ns logarithmic runtime
NoArgsRegular 74 ||||||||||||||
NoArgsNative 428 XX|||||||||||||||||||
FindClass 3064 XXXXXXXXXXXXXXXX|||||||||||
FindClassGetField 3654 XXXXXXXXXXXXXXXXXXX|||||||||
FindClassGetMethod 5634 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Change-Id: I41ab2b347895f043a7e21d8fa19e4541e198c3fc
ec2f5930802944b7e418bb97849071f538b2523c 08-May-2010 Brian Carlstrom <bdc@google.com> Moving most libcore .c files to .cpp

This change moves most of the libcore .c files to .cpp enough for them
to compile. This was largely motivated by the desire to avoid using
things like __attribute__ ((unused)) in .c files to supress warnings
in a recent change.

Change-Id: Ib967d9e16764ff805764e81362f945332080a06c
74c05e2a892f236c8648af7f4cfb2bcb483f267b 07-May-2010 Elliott Hughes <enh@google.com> Clean up the zlib-related native code.

All the dude wanted was to get rid of Get/Release*Critical... First, though I
needed to switch the C files over to C++, and getting them to compile with a
stricter compiler made me realize how much of this stuff is unnecessary junk.
Eventually, I managed to get rid of all the "hy" and "sieb" crap, and you can
actually see what's going on now.

As usual, this reduces duplication and fixes leaks. I've also fixed a bug where
we'd never update inCap, meaning that we'd always allocate a new buffer and
never reuse the existing one even if it was large enough.

Bug: 2663177
Change-Id: I71fcbf9ff958ebf71ef3063d50ea34c28c30dd26
6b811c5daec1b28e6f63b57f98a032236f2c3cf7 03-May-2010 Peter Hallam <peterhal@google.com> Merge awt-kernel, icu, luni-kernel, prefs, security-kernel, x-net into luni
Merge xml except xmlpull and kxml into luni