提交 2f6630f5 编写于 作者: K ksrini

7186945: Unpack200 improvement

Reviewed-by: jrose, jjh, mschoene
上级 0b60d355
...@@ -127,8 +127,10 @@ static jlong read_input_via_jni(unpacker* self, ...@@ -127,8 +127,10 @@ static jlong read_input_via_jni(unpacker* self,
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_sun_java_util_jar_pack_NativeUnpack_initIDs(JNIEnv *env, jclass clazz) { Java_com_sun_java_util_jar_pack_NativeUnpack_initIDs(JNIEnv *env, jclass clazz) {
#ifndef PRODUCT
dbg = getenv("DEBUG_ATTACH"); dbg = getenv("DEBUG_ATTACH");
while( dbg != null) { sleep(10); } while( dbg != null) { sleep(10); }
#endif
NIclazz = (jclass) env->NewGlobalRef(clazz); NIclazz = (jclass) env->NewGlobalRef(clazz);
unpackerPtrFID = env->GetFieldID(clazz, "unpackerPtr", "J"); unpackerPtrFID = env->GetFieldID(clazz, "unpackerPtr", "J");
currentInstMID = env->GetStaticMethodID(clazz, "currentInstance", currentInstMID = env->GetStaticMethodID(clazz, "currentInstance",
...@@ -230,11 +232,14 @@ Java_com_sun_java_util_jar_pack_NativeUnpack_getUnusedInput(JNIEnv *env, jobject ...@@ -230,11 +232,14 @@ Java_com_sun_java_util_jar_pack_NativeUnpack_getUnusedInput(JNIEnv *env, jobject
// We have fetched all the files. // We have fetched all the files.
// Now swallow up any remaining input. // Now swallow up any remaining input.
if (uPtr->input_remaining() == 0) if (uPtr->input_remaining() == 0) {
return null; return null;
else } else {
return env->NewDirectByteBuffer(uPtr->input_scan(), bytes remaining_bytes;
uPtr->input_remaining()); remaining_bytes.malloc(uPtr->input_remaining());
remaining_bytes.copyFrom(uPtr->input_scan(), uPtr->input_remaining());
return env->NewDirectByteBuffer(remaining_bytes.ptr, remaining_bytes.len);
}
} }
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册