8024087: Remove dead JVM_{Get,Set}PrimitiveFieldValues functions
The two functions were used to support JDK 1.3 but are no longer in use Reviewed-by: coleenp, ctornqvi, twisti, dsamersoff
This commit is contained in:
parent
13b13b1aed
commit
a9927a8ee9
@ -3954,248 +3954,6 @@ void initialize_converter_functions() {
|
||||
}
|
||||
|
||||
|
||||
// Serialization
|
||||
JVM_ENTRY(void, JVM_SetPrimitiveFieldValues(JNIEnv *env, jclass cb, jobject obj,
|
||||
jlongArray fieldIDs, jcharArray typecodes, jbyteArray data))
|
||||
assert(!JDK_Version::is_gte_jdk14x_version(), "should only be used in 1.3.1 and earlier");
|
||||
|
||||
typeArrayOop tcodes = typeArrayOop(JNIHandles::resolve(typecodes));
|
||||
typeArrayOop dbuf = typeArrayOop(JNIHandles::resolve(data));
|
||||
typeArrayOop fids = typeArrayOop(JNIHandles::resolve(fieldIDs));
|
||||
oop o = JNIHandles::resolve(obj);
|
||||
|
||||
if (o == NULL || fids == NULL || dbuf == NULL || tcodes == NULL) {
|
||||
THROW(vmSymbols::java_lang_NullPointerException());
|
||||
}
|
||||
|
||||
jsize nfids = fids->length();
|
||||
if (nfids == 0) return;
|
||||
|
||||
if (tcodes->length() < nfids) {
|
||||
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
|
||||
}
|
||||
|
||||
jsize off = 0;
|
||||
/* loop through fields, setting values */
|
||||
for (jsize i = 0; i < nfids; i++) {
|
||||
jfieldID fid = (jfieldID)(intptr_t) fids->long_at(i);
|
||||
int field_offset;
|
||||
if (fid != NULL) {
|
||||
// NULL is a legal value for fid, but retrieving the field offset
|
||||
// trigger assertion in that case
|
||||
field_offset = jfieldIDWorkaround::from_instance_jfieldID(o->klass(), fid);
|
||||
}
|
||||
|
||||
switch (tcodes->char_at(i)) {
|
||||
case 'Z':
|
||||
if (fid != NULL) {
|
||||
jboolean val = (dbuf->byte_at(off) != 0) ? JNI_TRUE : JNI_FALSE;
|
||||
o->bool_field_put(field_offset, val);
|
||||
}
|
||||
off++;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
if (fid != NULL) {
|
||||
o->byte_field_put(field_offset, dbuf->byte_at(off));
|
||||
}
|
||||
off++;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
if (fid != NULL) {
|
||||
jchar val = ((dbuf->byte_at(off + 0) & 0xFF) << 8)
|
||||
+ ((dbuf->byte_at(off + 1) & 0xFF) << 0);
|
||||
o->char_field_put(field_offset, val);
|
||||
}
|
||||
off += 2;
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
if (fid != NULL) {
|
||||
jshort val = ((dbuf->byte_at(off + 0) & 0xFF) << 8)
|
||||
+ ((dbuf->byte_at(off + 1) & 0xFF) << 0);
|
||||
o->short_field_put(field_offset, val);
|
||||
}
|
||||
off += 2;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
if (fid != NULL) {
|
||||
jint ival = ((dbuf->byte_at(off + 0) & 0xFF) << 24)
|
||||
+ ((dbuf->byte_at(off + 1) & 0xFF) << 16)
|
||||
+ ((dbuf->byte_at(off + 2) & 0xFF) << 8)
|
||||
+ ((dbuf->byte_at(off + 3) & 0xFF) << 0);
|
||||
o->int_field_put(field_offset, ival);
|
||||
}
|
||||
off += 4;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
if (fid != NULL) {
|
||||
jint ival = ((dbuf->byte_at(off + 0) & 0xFF) << 24)
|
||||
+ ((dbuf->byte_at(off + 1) & 0xFF) << 16)
|
||||
+ ((dbuf->byte_at(off + 2) & 0xFF) << 8)
|
||||
+ ((dbuf->byte_at(off + 3) & 0xFF) << 0);
|
||||
jfloat fval = (*int_bits_to_float_fn)(env, NULL, ival);
|
||||
o->float_field_put(field_offset, fval);
|
||||
}
|
||||
off += 4;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
if (fid != NULL) {
|
||||
jlong lval = (((jlong) dbuf->byte_at(off + 0) & 0xFF) << 56)
|
||||
+ (((jlong) dbuf->byte_at(off + 1) & 0xFF) << 48)
|
||||
+ (((jlong) dbuf->byte_at(off + 2) & 0xFF) << 40)
|
||||
+ (((jlong) dbuf->byte_at(off + 3) & 0xFF) << 32)
|
||||
+ (((jlong) dbuf->byte_at(off + 4) & 0xFF) << 24)
|
||||
+ (((jlong) dbuf->byte_at(off + 5) & 0xFF) << 16)
|
||||
+ (((jlong) dbuf->byte_at(off + 6) & 0xFF) << 8)
|
||||
+ (((jlong) dbuf->byte_at(off + 7) & 0xFF) << 0);
|
||||
o->long_field_put(field_offset, lval);
|
||||
}
|
||||
off += 8;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
if (fid != NULL) {
|
||||
jlong lval = (((jlong) dbuf->byte_at(off + 0) & 0xFF) << 56)
|
||||
+ (((jlong) dbuf->byte_at(off + 1) & 0xFF) << 48)
|
||||
+ (((jlong) dbuf->byte_at(off + 2) & 0xFF) << 40)
|
||||
+ (((jlong) dbuf->byte_at(off + 3) & 0xFF) << 32)
|
||||
+ (((jlong) dbuf->byte_at(off + 4) & 0xFF) << 24)
|
||||
+ (((jlong) dbuf->byte_at(off + 5) & 0xFF) << 16)
|
||||
+ (((jlong) dbuf->byte_at(off + 6) & 0xFF) << 8)
|
||||
+ (((jlong) dbuf->byte_at(off + 7) & 0xFF) << 0);
|
||||
jdouble dval = (*long_bits_to_double_fn)(env, NULL, lval);
|
||||
o->double_field_put(field_offset, dval);
|
||||
}
|
||||
off += 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Illegal typecode
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "illegal typecode");
|
||||
}
|
||||
}
|
||||
JVM_END
|
||||
|
||||
|
||||
JVM_ENTRY(void, JVM_GetPrimitiveFieldValues(JNIEnv *env, jclass cb, jobject obj,
|
||||
jlongArray fieldIDs, jcharArray typecodes, jbyteArray data))
|
||||
assert(!JDK_Version::is_gte_jdk14x_version(), "should only be used in 1.3.1 and earlier");
|
||||
|
||||
typeArrayOop tcodes = typeArrayOop(JNIHandles::resolve(typecodes));
|
||||
typeArrayOop dbuf = typeArrayOop(JNIHandles::resolve(data));
|
||||
typeArrayOop fids = typeArrayOop(JNIHandles::resolve(fieldIDs));
|
||||
oop o = JNIHandles::resolve(obj);
|
||||
|
||||
if (o == NULL || fids == NULL || dbuf == NULL || tcodes == NULL) {
|
||||
THROW(vmSymbols::java_lang_NullPointerException());
|
||||
}
|
||||
|
||||
jsize nfids = fids->length();
|
||||
if (nfids == 0) return;
|
||||
|
||||
if (tcodes->length() < nfids) {
|
||||
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
|
||||
}
|
||||
|
||||
/* loop through fields, fetching values */
|
||||
jsize off = 0;
|
||||
for (jsize i = 0; i < nfids; i++) {
|
||||
jfieldID fid = (jfieldID)(intptr_t) fids->long_at(i);
|
||||
if (fid == NULL) {
|
||||
THROW(vmSymbols::java_lang_NullPointerException());
|
||||
}
|
||||
int field_offset = jfieldIDWorkaround::from_instance_jfieldID(o->klass(), fid);
|
||||
|
||||
switch (tcodes->char_at(i)) {
|
||||
case 'Z':
|
||||
{
|
||||
jboolean val = o->bool_field(field_offset);
|
||||
dbuf->byte_at_put(off++, (val != 0) ? 1 : 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
dbuf->byte_at_put(off++, o->byte_field(field_offset));
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
{
|
||||
jchar val = o->char_field(field_offset);
|
||||
dbuf->byte_at_put(off++, (val >> 8) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 0) & 0xFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
{
|
||||
jshort val = o->short_field(field_offset);
|
||||
dbuf->byte_at_put(off++, (val >> 8) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 0) & 0xFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
{
|
||||
jint val = o->int_field(field_offset);
|
||||
dbuf->byte_at_put(off++, (val >> 24) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 16) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 8) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 0) & 0xFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
{
|
||||
jfloat fval = o->float_field(field_offset);
|
||||
jint ival = (*float_to_int_bits_fn)(env, NULL, fval);
|
||||
dbuf->byte_at_put(off++, (ival >> 24) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (ival >> 16) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (ival >> 8) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (ival >> 0) & 0xFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
{
|
||||
jlong val = o->long_field(field_offset);
|
||||
dbuf->byte_at_put(off++, (val >> 56) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 48) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 40) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 32) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 24) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 16) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 8) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (val >> 0) & 0xFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
{
|
||||
jdouble dval = o->double_field(field_offset);
|
||||
jlong lval = (*double_to_long_bits_fn)(env, NULL, dval);
|
||||
dbuf->byte_at_put(off++, (lval >> 56) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (lval >> 48) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (lval >> 40) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (lval >> 32) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (lval >> 24) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (lval >> 16) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (lval >> 8) & 0xFF);
|
||||
dbuf->byte_at_put(off++, (lval >> 0) & 0xFF);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Illegal typecode
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "illegal typecode");
|
||||
}
|
||||
}
|
||||
JVM_END
|
||||
|
||||
|
||||
// Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -35,22 +35,6 @@ jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Ha
|
||||
|
||||
void trace_class_resolution(Klass* to_class);
|
||||
|
||||
/*
|
||||
* Support for Serialization and RMI. Currently used by HotSpot only.
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
|
||||
void JNICALL
|
||||
JVM_SetPrimitiveFieldValues(JNIEnv *env, jclass cb, jobject obj,
|
||||
jlongArray fieldIDs, jcharArray typecodes, jbyteArray data);
|
||||
|
||||
void JNICALL
|
||||
JVM_GetPrimitiveFieldValues(JNIEnv *env, jclass cb, jobject obj,
|
||||
jlongArray fieldIDs, jcharArray typecodes, jbyteArray data);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Support for -Xcheck:jni
|
||||
*/
|
||||
|
@ -129,10 +129,6 @@ extern "C" {
|
||||
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
|
||||
|
||||
static JNINativeMethod lookup_special_native_methods[] = {
|
||||
// Next two functions only exist for compatibility with 1.3.1 and earlier.
|
||||
{ CC"Java_java_io_ObjectOutputStream_getPrimitiveFieldValues", NULL, FN_PTR(JVM_GetPrimitiveFieldValues) }, // intercept ObjectOutputStream getPrimitiveFieldValues for faster serialization
|
||||
{ CC"Java_java_io_ObjectInputStream_setPrimitiveFieldValues", NULL, FN_PTR(JVM_SetPrimitiveFieldValues) }, // intercept ObjectInputStream setPrimitiveFieldValues for faster serialization
|
||||
|
||||
{ CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
|
||||
{ CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
|
||||
{ CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) },
|
||||
@ -140,9 +136,8 @@ static JNINativeMethod lookup_special_native_methods[] = {
|
||||
};
|
||||
|
||||
static address lookup_special_native(char* jni_name) {
|
||||
int i = !JDK_Version::is_gte_jdk14x_version() ? 0 : 2; // see comment in lookup_special_native_methods
|
||||
int count = sizeof(lookup_special_native_methods) / sizeof(JNINativeMethod);
|
||||
for (; i < count; i++) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
// NB: To ignore the jni prefix and jni postfix strstr is used matching.
|
||||
if (strstr(jni_name, lookup_special_native_methods[i].name) != NULL) {
|
||||
return CAST_FROM_FN_PTR(address, lookup_special_native_methods[i].fnPtr);
|
||||
|
Loading…
Reference in New Issue
Block a user