< prev index next >

src/java.base/share/native/libjava/Array.c

Print this page

 29 
 30 /*
 31  * Native code for java.lang.reflect.Array.
 32  *
 33  * TODO: Performance
 34  */
 35 
 36 /*
 37  *
 38  */
 39 JNIEXPORT jint JNICALL
 40 Java_java_lang_reflect_Array_getLength(JNIEnv *env, jclass ignore, jobject arr)
 41 {
 42     return JVM_GetArrayLength(env, arr);
 43 }
 44 
 45 /*
 46  *
 47  */
 48 JNIEXPORT jobject JNICALL
 49 Java_java_lang_reflect_Array_get(JNIEnv *env, jclass ignore, jobject arr,
 50                                  jint index)
 51 {
 52     return JVM_GetArrayElement(env, arr, index);
 53 }
 54 
 55 JNIEXPORT jboolean JNICALL
 56 Java_java_lang_reflect_Array_getBoolean(JNIEnv *env, jclass ignore, jobject arr,
 57                                         jint index)
 58 {
 59     return JVM_GetPrimitiveArrayElement(env, arr, index, JVM_T_BOOLEAN).z;
 60 }
 61 
 62 JNIEXPORT jbyte JNICALL
 63 Java_java_lang_reflect_Array_getByte(JNIEnv *env, jclass ignore, jobject arr,
 64                                      jint index)
 65 {
 66     return JVM_GetPrimitiveArrayElement(env, arr, index, JVM_T_BYTE).b;
 67 }
 68 
 69 JNIEXPORT jchar JNICALL
 70 Java_java_lang_reflect_Array_getChar(JNIEnv *env, jclass ignore, jobject arr,

 95 }
 96 
 97 JNIEXPORT jfloat JNICALL
 98 Java_java_lang_reflect_Array_getFloat(JNIEnv *env, jclass ignore, jobject arr,
 99                                      jint index)
100 {
101     return JVM_GetPrimitiveArrayElement(env, arr, index, JVM_T_FLOAT).f;
102 }
103 
104 JNIEXPORT jdouble JNICALL
105 Java_java_lang_reflect_Array_getDouble(JNIEnv *env, jclass ignore, jobject arr,
106                                      jint index)
107 {
108     return JVM_GetPrimitiveArrayElement(env, arr, index, JVM_T_DOUBLE).d;
109 }
110 
111 /*
112  *
113  */
114 JNIEXPORT void JNICALL
115 Java_java_lang_reflect_Array_set(JNIEnv *env, jclass ignore, jobject arr,
116                                  jint index, jobject val)
117 {
118     JVM_SetArrayElement(env, arr, index, val);
119 }
120 
121 JNIEXPORT void JNICALL
122 Java_java_lang_reflect_Array_setBoolean(JNIEnv *env, jclass ignore,
123                                         jobject arr, jint index, jboolean z)
124 {
125     jvalue v;
126     v.z = z;
127     JVM_SetPrimitiveArrayElement(env, arr, index, v, JVM_T_BOOLEAN);
128 }
129 
130 JNIEXPORT void JNICALL
131 Java_java_lang_reflect_Array_setByte(JNIEnv *env, jclass ignore,
132                                         jobject arr, jint index, jbyte b)
133 {
134     jvalue v;
135     v.b = b;
136     JVM_SetPrimitiveArrayElement(env, arr, index, v, JVM_T_BYTE);

 29 
 30 /*
 31  * Native code for java.lang.reflect.Array.
 32  *
 33  * TODO: Performance
 34  */
 35 
 36 /*
 37  *
 38  */
 39 JNIEXPORT jint JNICALL
 40 Java_java_lang_reflect_Array_getLength(JNIEnv *env, jclass ignore, jobject arr)
 41 {
 42     return JVM_GetArrayLength(env, arr);
 43 }
 44 
 45 /*
 46  *
 47  */
 48 JNIEXPORT jobject JNICALL
 49 Java_java_lang_reflect_Array_getReferenceOrPrimitive(JNIEnv *env, jclass ignore, jobject arr,
 50                                                      jint index)
 51 {
 52     return JVM_GetArrayElement(env, arr, index);
 53 }
 54 
 55 JNIEXPORT jboolean JNICALL
 56 Java_java_lang_reflect_Array_getBoolean(JNIEnv *env, jclass ignore, jobject arr,
 57                                         jint index)
 58 {
 59     return JVM_GetPrimitiveArrayElement(env, arr, index, JVM_T_BOOLEAN).z;
 60 }
 61 
 62 JNIEXPORT jbyte JNICALL
 63 Java_java_lang_reflect_Array_getByte(JNIEnv *env, jclass ignore, jobject arr,
 64                                      jint index)
 65 {
 66     return JVM_GetPrimitiveArrayElement(env, arr, index, JVM_T_BYTE).b;
 67 }
 68 
 69 JNIEXPORT jchar JNICALL
 70 Java_java_lang_reflect_Array_getChar(JNIEnv *env, jclass ignore, jobject arr,

 95 }
 96 
 97 JNIEXPORT jfloat JNICALL
 98 Java_java_lang_reflect_Array_getFloat(JNIEnv *env, jclass ignore, jobject arr,
 99                                      jint index)
100 {
101     return JVM_GetPrimitiveArrayElement(env, arr, index, JVM_T_FLOAT).f;
102 }
103 
104 JNIEXPORT jdouble JNICALL
105 Java_java_lang_reflect_Array_getDouble(JNIEnv *env, jclass ignore, jobject arr,
106                                      jint index)
107 {
108     return JVM_GetPrimitiveArrayElement(env, arr, index, JVM_T_DOUBLE).d;
109 }
110 
111 /*
112  *
113  */
114 JNIEXPORT void JNICALL
115 Java_java_lang_reflect_Array_setReferenceOrPrimitive(JNIEnv *env, jclass ignore, jobject arr,
116                                                      jint index, jobject val)
117 {
118     JVM_SetArrayElement(env, arr, index, val);
119 }
120 
121 JNIEXPORT void JNICALL
122 Java_java_lang_reflect_Array_setBoolean(JNIEnv *env, jclass ignore,
123                                         jobject arr, jint index, jboolean z)
124 {
125     jvalue v;
126     v.z = z;
127     JVM_SetPrimitiveArrayElement(env, arr, index, v, JVM_T_BOOLEAN);
128 }
129 
130 JNIEXPORT void JNICALL
131 Java_java_lang_reflect_Array_setByte(JNIEnv *env, jclass ignore,
132                                         jobject arr, jint index, jbyte b)
133 {
134     jvalue v;
135     v.b = b;
136     JVM_SetPrimitiveArrayElement(env, arr, index, v, JVM_T_BYTE);
< prev index next >