7cd6760f7045d771faae8080a8c6150bf678f679 |
|
04-May-2012 |
Elliott Hughes <enh@google.com> |
Make libjavacore independent of libnativehelper for the PDK. Bug: 6369821 Change-Id: Ie038571a5dac1f301c0c3c6fb84df432e67b62c0
|
2ff37ac3a15fde7d47cd8cf3b8ee6946dd24eeb3 |
|
07-Dec-2010 |
Elliott Hughes <enh@google.com> |
Targeted backport of a java.util.Inflater fix. This has been causing trouble for Gmail. The original fix cleaned up large parts of the java.util.zip code; this just contains the active ingredient. (I've excluded the error-handling change to this same function because that hasn't been tested in the real world yet.) Bug: 3220923 Change-Id: Ib4bc585a45061ef55c29f09f2bd650c772aab64d
|
2d9c5fa8ce0182cd8c14736241b709fd50cab6f8 |
|
23-Nov-2010 |
Elliott Hughes <enh@google.com> |
Slight cleanup of java.util.zip code, plus a bug fix. The key fix is switching to zstream's next_in and next_out fields (the pointers into the input and output buffers) rather than relying on the integer "accounting" fields. If turns out in the Z_NEED_DICT case that the accounting goes slightly awry. (We shouldn't have been using the accounting anyway, because we were silently coercing longs to ints.) The new code is simpler, clearer, and doesn't need a special case for Z_NEED_DICT at all. I've also removed yet another hand-written UTF-8 encoder, made Inflater throw ArrayIndexOutOfBoundsExceptions with useful detail messages (factored out into Arrays so we can make this change more widely), and rewritten the Inflater and Deflater documentation. The unit test reproduces the problem (and tests as many other cases as it can too). Critical for testing this bug is that we needed to limit the size of the input buffer so that zlib has to ask us for more input. Bug: 3220923 Change-Id: I39e5456620eaa7f75d12d885db279f009ee3e8ef
|
e22935d3c7040c22b48d53bd18878844f381287c |
|
13-Aug-2010 |
Elliott Hughes <enh@google.com> |
Remove most of our C-style casts. After being burned by an incorrect C-style cast that cast away const, I've been keen to remove them all and turn on -Wold-style-cast. This patch doesn't get us that far, but it does kill the majority of our C-style casts. In turn, the majority of the casts that it removes are the ones from our tables of native methods to be registered. The new NATIVE_METHOD macro also _enforces_ our convention of using the "Class_nativeMethod" style of naming. Mostly this works out fine. In some cases (most notably ExpatParser and ExpatAttributes) I've had to un-overload a few functions, but I don't like overloading anyway, and in the particular case of a native method, where the stack trace doesn't show a line number, overloading makes it one step harder to work out which native method you're actually in. So good riddance to that. The only unfortunate case is Math.copySign, where there are two overloads corresponding to copysign(3) and copysignf(3). I had to add an extra layer of indirection there. In my defense, we've never shipped these functions before, they're unlikely to become anyone's hotspot, and the right fix is to be doing such trivial work on the Java side anyway, with intrinsics making the conversion between float/double and int/long cheap. This patch also replaces other C-style casts, primarily in "OSNetworkSystem.cpp". This patch also removes unnecessary uses of the "struct" keyword. This patch also fixes a "may be used uninitialized" warning (now error) in the sim build for "ICU.cpp". The remaining C-style casts are in the hairy float-parsing code. That stuff -- and turning on -Wold-style-cast -- will have to wait for another day. Change-Id: I9b3ee14aefd4676f980f6a7ca757595d78d80e6a
|
0adb7b318dd5d67559d5b31b1ef3280dd72e1f5f |
|
17-Jul-2010 |
Elliott Hughes <enh@google.com> |
Fix a long-latent bug in the zip code, exposed by -Xjniopts:forcecopy. We were using ScopedByteArrayRO to access a byte[] read-write, and accidentally relying on the fact that normally the VM will give us a pointer to the actual array. A C-style cast that cast away const hid this obvious bug from the compiler, so this patch also removes all the other C-style casts from the zip code. Change-Id: I15b2175af7d089ddc86448f54219abef2a9ef8cd
|
64101124267c6a0a9a12dc854bdec39cbc506259 |
|
12-Jul-2010 |
Elliott Hughes <enh@google.com> |
Add null-pointer checking to ScopedPrimitiveArray. This style worked well for ScopedUtfChars. It moves null-pointer checking inside the class, thereby encouraging us to remember to check for the unlikely out-of-memory failures too. I've also broken up some tests that were trying to check multiple scoped arrays at once. This idiom was broken because as soon as there's a pending exception, it's a JNI error to even attempt to set up the next scoped primitive array. In the absence of C++ exceptions, we have to check these one by one. Change-Id: I2f4b397ae2873597e309d86fcc5912f3fcf0f304
|
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
|
abf945fb9ce99d8c2769ac5b2691b2732fa59887 |
|
04-Jun-2010 |
Elliott Hughes <enh@google.com> |
Bullet-proof the lseek/read in Inflater.setFileInput. Also document why that non-API method exists, and that we don't have benchmarks to support the claimed optimization. Also be more consistent about setting LOG_TAG, and fix a few old-school copyright headers. Change-Id: If9fdc4583eaf91275ed44e2dc56174819d1913d0
|
f27475b3c3fc4c95569b9a4045cae1d6e846354a |
|
03-Jun-2010 |
Jesse Wilson <jessewilson@google.com> |
Fixing a bug in inflate where refilling a file doesn't update the zip stream. See bug http://b/issue?id=2734751 Change-Id: Iff5f7e564518805151a60f56d6f19a584c9e0b44
|
ebca53a204302c5e559b5c2c9014b48048faf4d4 |
|
21-May-2010 |
Elliott Hughes <enh@google.com> |
Add write-back ScopedPrimitiveArrays (and use them). I've left the remaining Get/Release Critical calls in "NativeConverter.cpp" for the next patch, even though getting into position to fix them is part of the point of this patch. Change-Id: I99e15a3cf3919008343ae4dc856c86ced233e07a
|
99c59bfa432e36933a7a5033fba8b89209f737bc |
|
18-May-2010 |
Elliott Hughes <enh@google.com> |
Expand upon the old ScopedByteArray, and start removing some of the Get/ReleaseCritical calls. This adds Scoped*Array classes for all primitive types, and switches all read-only users of arrays over. At the same time, all read-only users of Get/ReleaseCritical get switched to non-critical access. Bug: 2663177 Change-Id: I5542cea3e24faa987ced463fcb695b9598da94af
|
0356c447b30e092bdc12a4b7288c08f5ef87534c |
|
08-May-2010 |
Elliott Hughes <enh@google.com> |
Fix sim build, remove static initalizers from Deflater/Inflater. Change-Id: I56a453a1382559cdcf9f22c6a185db7178fbe098
|
44e0e560c92338110953ce806df475fedcdf926e |
|
07-May-2010 |
Brian Carlstrom <bdc@google.com> |
Enable -Wall -Wextra for libcore and cleanup all but one warning Change-Id: Ied76662c470ba878cec61189acf29f5cbbd4ccd4
|
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
|