-/* asm_builtin_arraycheckcast **************************************************
-
- Does the cast check and eventually throws an exception.
-
-*******************************************************************************/
-
-asm_builtin_arraycheckcast:
- sub $8,%esp /* build stack frame (2 * 4 bytes) */
-
- mov 12(%esp),%eax /* first param: 8 (frame) + 4 (return)*/
- mov %eax,(%esp) /* save object pointer */
-
- mov 16(%esp),%eax /* second param: 8 (frame) + 4 (return) + 4*/
- mov %eax,4(%esp)
-
- call builtin_arraycheckcast
-
- test %eax,%eax /* if (false) throw exception */
- je nb_carray_throw
-
- mov 12(%esp),%eax /* return object pointer */
- add $8,%esp
- ret
-
-nb_carray_throw:
- add $8,%esp
- mov string_java_lang_ClassCastException,%eax
- pop %ecx
- sub $2,%ecx
- jmp asm_throw_and_handle_exception
-#if 0
- push string_java_lang_ClassCastException
- call new_exception
- add $(1*4),%esp
-
- add $8,%esp
-
- pop %ecx /* delete return address */
- sub $2,%ecx /* faulting address is return adress - 2 */
- jmp asm_handle_exception
-#endif
-
-
-/******************* function asm_builtin_aastore ******************************
-* *
-* Does the cast check and eventually throws an exception *
-* void asm_builtin_aastore(java_objectarray *a, s4 index, java_objectheader *o)*
-*******************************************************************************/
-
-asm_builtin_aastore:
- sub $12,%esp /* build stack frame (3 * 4 bytes) */
-
- mov 16(%esp),%eax /* 12 (frame) + 4 (return) */
- test %eax,%eax /* if null pointer throw exception */
- je nb_aastore_null
-
- mov offarraysize(%eax),%edx /* load size */
- mov 20(%esp),%ecx /* index (12 + 4 + 4) */
- cmp %edx,%ecx /* do bound check */
- jae nb_aastore_bound /* if out of bounds throw exception */
-
- shl $2,%ecx /* index * 4 */
- add %eax,%ecx /* add index * 4 to arrayref */
-
- mov %ecx,8(%esp) /* save store position */
-
- mov 16(%esp),%eax /* 12 (frame) + 4 (return) */
- mov %eax,(%esp)
-
- mov 24(%esp),%eax /* object is second argument (12+4+4+4) */
- mov %eax,4(%esp)
-
- call builtin_canstore /* builtin_canstore(arrayref,object) */
-
- test %eax,%eax /* if (false) throw exception */
- je nb_aastore_store
-
- mov 24(%esp),%eax
- mov 8(%esp),%ecx
- mov %eax,offobjarrdata(%ecx) /* store objectptr in array */
-
- add $12,%esp
- ret
-
-nb_aastore_null:
- add $12,%esp
- mov string_java_lang_NullPointerException,%eax
- pop %ecx
- sub $2,%ecx
- jmp asm_throw_and_handle_exception
-
-#if 0
- push string_java_lang_NullPointerException
- call new_exception
- add $(1*4),%esp
-
- add $12,%esp
- pop %ecx /* delete return address */
- sub $2,%ecx /* faulting address is return adress - 2 */
- jmp asm_handle_exception
-#endif
-nb_aastore_bound:
- add $12,%esp
- mov %ecx,%eax /* itmp2 contains array index */
- pushl $0 /*directly below return adress*/
- pushl $0 /*internal (invisible) method*/
- call asm_prepare_native_stackinfo /* puts 2*4 bytes onto stack*/
-
- push %eax
- call new_arrayindexoutofboundsexception
- add $(1*4),%esp
-
- call asm_remove_native_stackinfo /*return adress is the first on stack again*/
-
- pop %ecx /* delete return address */
- sub $2,%ecx /* faulting address is return adress - 2 */
- jmp asm_handle_exception
-
-nb_aastore_store:
- add $12,%esp
-
- mov string_java_lang_ArrayStoreException,%eax
- pop %ecx
- sub $2,%ecx
- jmp asm_throw_and_handle_exception
-
-#if 0
- push string_java_lang_ArrayStoreException
- call new_exception
- add $(1*4),%esp
-
- add $12,%esp
- pop %ecx /* delete return address */
- sub $2,%ecx /* faulting address is return adress - 2 */
- jmp asm_handle_exception
-#endif
-
-