blob: 943b55cc6cd9c7d2638fd4a447b771fa7b22ad83 [file] [log] [blame]
Elliott Hughes0f3c5532012-03-30 14:51:51 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Ian Rogers57b86d42012-03-27 16:05:41 -070017#include "asm_support.h"
18
19#if defined(__APPLE__)
Elliott Hughes787ec202012-03-29 17:14:15 -070020 // Mac OS' as(1) doesn't let you name macro parameters.
21 #define MACRO0(macro_name) .macro macro_name
22 #define MACRO1(macro_name, macro_arg1) .macro macro_name
23 #define MACRO2(macro_name, macro_arg1, macro_args2) .macro macro_name
24 #define END_MACRO .endmacro
25
26 // Mac OS' as(1) uses $0, $1, and so on for macro arguments, and function names
27 // are mangled with an extra underscore prefix. The use of $x for arguments
28 // mean that literals need to be represented with $$x in macros.
29 #define VAR(name,index) _$index
30 #define LITERAL(value) $$value
31#else
32 // Regular gas(1) lets you name macro parameters.
33 #define MACRO0(macro_name) .macro macro_name
34 #define MACRO1(macro_name, macro_arg1) .macro macro_name macro_arg1
35 #define MACRO2(macro_name, macro_arg1, macro_arg2) .macro macro_name macro_arg1, macro_arg2
36 #define END_MACRO .endm
37
38 // Regular gas(1) uses \argument_name for macro arguments.
39 // We need to turn on alternate macro syntax so we can use & instead or the preprocessor
40 // will screw us by inserting a space between the \ and the name. Even in this mode there's
41 // no special meaning to $, so literals are still just $x.
42 .altmacro
43 #define VAR(name,index) name&
44 #define LITERAL(value) $value
Ian Rogers57b86d42012-03-27 16:05:41 -070045#endif
46
Ian Rogers57b86d42012-03-27 16:05:41 -070047 /* Cache alignment for function entry */
Elliott Hughes787ec202012-03-29 17:14:15 -070048MACRO0(ALIGN_FUNCTION_ENTRY)
Ian Rogers57b86d42012-03-27 16:05:41 -070049 .balign 16
Elliott Hughes787ec202012-03-29 17:14:15 -070050END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -070051
52 /*
53 * Macro that sets up the callee save frame to conform with
Ian Rogers7caad772012-03-30 01:07:54 -070054 * Runtime::CreateCalleeSaveMethod(kSaveAll)
Ian Rogers57b86d42012-03-27 16:05:41 -070055 */
Elliott Hughes787ec202012-03-29 17:14:15 -070056MACRO0(SETUP_SAVE_ALL_CALLEE_SAVE_FRAME)
Ian Rogers57b86d42012-03-27 16:05:41 -070057 pushl %edi // Save callee saves (ebx is saved/restored by the upcall)
58 pushl %esi
59 pushl %ebp
Elliott Hughes787ec202012-03-29 17:14:15 -070060 subl LITERAL(16), %esp // Grow stack by 4 words, bottom word will hold Method*
61END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -070062
Ian Rogers7caad772012-03-30 01:07:54 -070063 /*
64 * Macro that sets up the callee save frame to conform with
65 * Runtime::CreateCalleeSaveMethod(kRefsOnly)
66 */
67MACRO0(SETUP_REF_ONLY_CALLEE_SAVE_FRAME)
68 pushl %edi // Save callee saves (ebx is saved/restored by the upcall)
69 pushl %esi
70 pushl %ebp
71 subl LITERAL(16), %esp // Grow stack by 4 words, bottom word will hold Method*
72END_MACRO
73
74MACRO0(RESTORE_REF_ONLY_CALLEE_SAVE_FRAME)
75 addl LITERAL(28), %esp // Unwind stack up to return address
Elliott Hughes787ec202012-03-29 17:14:15 -070076END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -070077
78 /*
79 * Macro that sets up the callee save frame to conform with
Ian Rogers7caad772012-03-30 01:07:54 -070080 * Runtime::CreateCalleeSaveMethod(kRefsAndArgs)
Ian Rogers57b86d42012-03-27 16:05:41 -070081 */
Elliott Hughes787ec202012-03-29 17:14:15 -070082MACRO0(SETUP_REF_AND_ARG_CALLEE_SAVE_FRAME)
Ian Rogers57b86d42012-03-27 16:05:41 -070083 pushl %edi // Save callee saves
84 pushl %esi
85 pushl %ebp
86 pushl %ebx // Save args
87 pushl %edx
88 pushl %ecx
89 pushl %eax // Align stack, eax will be clobbered by Method*
Elliott Hughes787ec202012-03-29 17:14:15 -070090END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -070091
Elliott Hughes787ec202012-03-29 17:14:15 -070092MACRO0(RESTORE_REF_AND_ARG_CALLEE_SAVE_FRAME)
Ian Rogers7caad772012-03-30 01:07:54 -070093 addl LITERAL(4), %esp // Remove padding
94 popl %ecx // Restore args except eax
95 popl %edx
96 popl %ebx
Ian Rogers57b86d42012-03-27 16:05:41 -070097 popl %ebp // Restore callee saves
98 popl %esi
99 popl %edi
Elliott Hughes787ec202012-03-29 17:14:15 -0700100END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -0700101
102 /*
103 * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending
104 * exception is Thread::Current()->exception_.
105 */
Elliott Hughes787ec202012-03-29 17:14:15 -0700106MACRO0(DELIVER_PENDING_EXCEPTION)
Ian Rogers57b86d42012-03-27 16:05:41 -0700107 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME // save callee saves for throw
108 mov %esp, %ecx
109 // Outgoing argument set up
Elliott Hughes787ec202012-03-29 17:14:15 -0700110 subl LITERAL(8), %esp // Alignment padding
Ian Rogers57b86d42012-03-27 16:05:41 -0700111 pushl %ecx // pass SP
112 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
113 call artDeliverPendingExceptionFromCode // artDeliverExceptionFromCode(Thread*, SP)
114 int3
Elliott Hughes787ec202012-03-29 17:14:15 -0700115END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -0700116
Elliott Hughes787ec202012-03-29 17:14:15 -0700117MACRO2(NO_ARG_RUNTIME_EXCEPTION, c_name, cxx_name)
118 .globl VAR(c_name, 0)
Ian Rogers57b86d42012-03-27 16:05:41 -0700119 ALIGN_FUNCTION_ENTRY
Elliott Hughes787ec202012-03-29 17:14:15 -0700120VAR(c_name, 0):
Ian Rogers57b86d42012-03-27 16:05:41 -0700121 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME // save all registers as basis for long jump context
122 mov %esp, %ecx
123 // Outgoing argument set up
Elliott Hughes787ec202012-03-29 17:14:15 -0700124 subl LITERAL(8), %esp // alignment padding
Ian Rogers57b86d42012-03-27 16:05:41 -0700125 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
126 pushl %ecx // pass SP
Elliott Hughes787ec202012-03-29 17:14:15 -0700127 call VAR(cxx_name, 1) // cxx_name(Thread*, SP)
Ian Rogers57b86d42012-03-27 16:05:41 -0700128 int3 // unreached
Elliott Hughes787ec202012-03-29 17:14:15 -0700129END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -0700130
Elliott Hughes787ec202012-03-29 17:14:15 -0700131MACRO2(ONE_ARG_RUNTIME_EXCEPTION, c_name, cxx_name)
132 .globl VAR(c_name, 0)
Ian Rogers57b86d42012-03-27 16:05:41 -0700133 ALIGN_FUNCTION_ENTRY
Elliott Hughes787ec202012-03-29 17:14:15 -0700134VAR(c_name, 0):
Ian Rogers57b86d42012-03-27 16:05:41 -0700135 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME // save all registers as basis for long jump context
136 mov %esp, %ecx
137 // Outgoing argument set up
Elliott Hughes787ec202012-03-29 17:14:15 -0700138 pushl LITERAL(0) // alignment padding
Ian Rogers57b86d42012-03-27 16:05:41 -0700139 pushl %ecx // pass SP
140 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
141 pushl %eax // pass arg1
Elliott Hughes787ec202012-03-29 17:14:15 -0700142 call VAR(cxx_name, 1) // cxx_name(arg1, Thread*, SP)
Ian Rogers57b86d42012-03-27 16:05:41 -0700143 int3 // unreached
Elliott Hughes787ec202012-03-29 17:14:15 -0700144END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -0700145
Elliott Hughes787ec202012-03-29 17:14:15 -0700146MACRO2(TWO_ARG_RUNTIME_EXCEPTION, c_name, cxx_name)
147 .globl VAR(c_name, 0)
Ian Rogers57b86d42012-03-27 16:05:41 -0700148 ALIGN_FUNCTION_ENTRY
Elliott Hughes787ec202012-03-29 17:14:15 -0700149VAR(c_name, 0):
Ian Rogers57b86d42012-03-27 16:05:41 -0700150 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME // save all registers as basis for long jump context
151 mov %esp, %edx
152 // Outgoing argument set up
153 pushl %edx // pass SP
154 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
Ian Rogers57b86d42012-03-27 16:05:41 -0700155 pushl %ecx // pass arg2
Ian Rogers7caad772012-03-30 01:07:54 -0700156 pushl %eax // pass arg1
157 call VAR(cxx_name, 1) // cxx_name(arg1, arg2, Thread*, SP)
Ian Rogers57b86d42012-03-27 16:05:41 -0700158 int3 // unreached
Elliott Hughes787ec202012-03-29 17:14:15 -0700159END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -0700160
161 /*
162 * Called by managed code to create and deliver a NullPointerException.
163 */
164NO_ARG_RUNTIME_EXCEPTION art_throw_null_pointer_exception_from_code, artThrowNullPointerExceptionFromCode
165
166 /*
167 * Called by managed code to create and deliver an ArithmeticException.
168 */
169NO_ARG_RUNTIME_EXCEPTION art_throw_div_zero_from_code, artThrowDivZeroFromCode
170
171 /*
Ian Rogers57b86d42012-03-27 16:05:41 -0700172 * Called by managed code to create and deliver a StackOverflowError.
173 */
174NO_ARG_RUNTIME_EXCEPTION art_throw_stack_overflow_from_code, artThrowStackOverflowFromCode
175
176 /*
Elliott Hughes787ec202012-03-29 17:14:15 -0700177 * Called by managed code, saves callee saves and then calls artThrowException
178 * that will place a mock Method* at the bottom of the stack. Arg1 holds the exception.
179 */
180ONE_ARG_RUNTIME_EXCEPTION art_deliver_exception_from_code, artDeliverExceptionFromCode
181
182 /*
Ian Rogers57b86d42012-03-27 16:05:41 -0700183 * Called by managed code to create and deliver a NoSuchMethodError.
184 */
185ONE_ARG_RUNTIME_EXCEPTION art_throw_no_such_method_from_code, artThrowNoSuchMethodFromCode
186
187 /*
Elliott Hughes787ec202012-03-29 17:14:15 -0700188 * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException. Arg1 holds
189 * index, arg2 holds limit.
190 */
191TWO_ARG_RUNTIME_EXCEPTION art_throw_array_bounds_from_code, artThrowArrayBoundsFromCode
192
193 /*
Ian Rogers57b86d42012-03-27 16:05:41 -0700194 * Called by managed code to create and deliver verification errors. Arg1 is kind, arg2 is ref.
195 */
196TWO_ARG_RUNTIME_EXCEPTION art_throw_verification_error_from_code, artThrowVerificationErrorFromCode
197
198 /*
199 * All generated callsites for interface invokes and invocation slow paths will load arguments
200 * as usual - except instead of loading arg0/r0 with the target Method*, arg0/r0 will contain
201 * the method_idx. This wrapper will save arg1-arg3, load the caller's Method*, align the
202 * stack and call the appropriate C helper.
203 * NOTE: "this" is first visible argument of the target, and so can be found in arg1/r1.
204 *
205 * The helper will attempt to locate the target and return a 64-bit result in r0/r1 consisting
206 * of the target Method* in r0 and method->code_ in r1.
207 *
208 * If unsuccessful, the helper will return NULL/NULL. There will bea pending exception in the
209 * thread and we branch to another stub to deliver it.
210 *
211 * On success this wrapper will restore arguments and *jump* to the target, leaving the lr
212 * pointing back to the original caller.
213 */
Elliott Hughes787ec202012-03-29 17:14:15 -0700214MACRO2(INVOKE_TRAMPOLINE, c_name, cxx_name)
215 .globl VAR(c_name, 0)
Ian Rogers57b86d42012-03-27 16:05:41 -0700216 ALIGN_FUNCTION_ENTRY
Elliott Hughes787ec202012-03-29 17:14:15 -0700217VAR(c_name, 0):
Ian Rogers7caad772012-03-30 01:07:54 -0700218 // Set up the callee save frame to conform with Runtime::CreateCalleeSaveMethod(kRefsAndArgs)
219 // return address
220 pushl %edi
221 pushl %esi
222 pushl %ebp
223 pushl %ebx
224 pushl %edx
225 pushl %ecx
226 pushl %eax // <-- callee save Method* to go here
227 movl %esp, %edx // remember SP
228 // Outgoing argument set up
229 subl LITERAL(12), %esp // alignment padding
230 pushl %edx // pass SP
231 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
232 pushl 32(%edx) // pass caller Method*
233 pushl %ecx // pass arg2
234 pushl %eax // pass arg1
235 call VAR(cxx_name, 1) // cxx_name(arg1, arg2, arg3, Thread*, SP)
236 movl %edx, %edi // save code pointer in EDI
237 addl LITERAL(36), %esp // Pop arguments skip eax
238 popl %ecx // Restore args
239 popl %edx
240 popl %ebx
241 popl %ebp // Restore callee saves.
242 popl %esi
243 // Swap EDI callee save with code pointer.
244 xchgl %edi, (%esp)
245 testl %eax, %eax // Branch forward if exception pending.
246 jz 1f
247 // Tail call to intended method.
248 ret
2491:
250 DELIVER_PENDING_EXCEPTION
Elliott Hughes787ec202012-03-29 17:14:15 -0700251END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -0700252
253INVOKE_TRAMPOLINE art_invoke_interface_trampoline, artInvokeInterfaceTrampoline
254INVOKE_TRAMPOLINE art_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck
255
256INVOKE_TRAMPOLINE art_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck
257INVOKE_TRAMPOLINE art_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck
258INVOKE_TRAMPOLINE art_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck
259INVOKE_TRAMPOLINE art_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck
260
Ian Rogers7caad772012-03-30 01:07:54 -0700261MACRO2(TWO_ARG_ALLOC, c_name, cxx_name)
262 .globl VAR(c_name, 0)
263 ALIGN_FUNCTION_ENTRY
264VAR(c_name, 0):
265 SETUP_REF_ONLY_CALLEE_SAVE_FRAME // save ref containing registers for GC
266 mov %esp, %edx // remember SP
267 // Outgoing argument set up
268 pushl %edx // pass SP
269 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
270 pushl %ecx // pass arg2
271 pushl %eax // pass arg1
272 call VAR(cxx_name, 1) // cxx_name(arg1, arg2, arg3, Thread*, SP)
273 addl LITERAL(16), %esp // pop arguments
274 RESTORE_REF_ONLY_CALLEE_SAVE_FRAME // restore frame up to return address
275 testl %eax, %eax // eax == 0 ?
276 jz 1f
277 ret
2781:
279 DELIVER_PENDING_EXCEPTION
280END_MACRO
281
282MACRO2(THREE_ARG_ALLOC, c_name, cxx_name)
283 .globl VAR(c_name, 0)
284 ALIGN_FUNCTION_ENTRY
285VAR(c_name, 0):
286 SETUP_REF_ONLY_CALLEE_SAVE_FRAME // save ref containing registers for GC
287 mov %esp, %ebx // remember SP
288 // Outgoing argument set up
289 subl LITERAL(12), %esp // alignment padding
290 pushl %ebx // pass SP
291 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
292 pushl %edx // pass arg3
293 pushl %ecx // pass arg2
294 pushl %eax // pass arg1
295 call VAR(cxx_name, 1) // cxx_name(arg1, arg2, Thread*, SP)
296 addl LITERAL(32), %esp // pop arguments
297 RESTORE_REF_ONLY_CALLEE_SAVE_FRAME // restore frame up to return address
298 testl %eax, %eax // eax == 0 ?
299 jz 1f
300 ret
3011:
302 DELIVER_PENDING_EXCEPTION
303END_MACRO
304
305TWO_ARG_ALLOC art_alloc_object_from_code, artAllocObjectFromCode
306TWO_ARG_ALLOC art_alloc_object_from_code_with_access_check, artAllocObjectFromCodeWithAccessCheck
307THREE_ARG_ALLOC art_alloc_array_from_code, artAllocArrayFromCode
308THREE_ARG_ALLOC art_alloc_array_from_code_with_access_check, artAllocArrayFromCodeWithAccessCheck
309THREE_ARG_ALLOC art_check_and_alloc_array_from_code, artCheckAndAllocArrayFromCode
310THREE_ARG_ALLOC art_check_and_alloc_array_from_code_with_access_check, artCheckAndAllocArrayFromCodeWithAccessCheck
311
312TWO_ARG_ALLOC art_resolve_string_from_code, artResolveStringFromCode
313TWO_ARG_ALLOC art_initialize_static_storage_from_code, artInitializeStaticStorageFromCode
314
315 .globl art_lock_object_from_code
316 ALIGN_FUNCTION_ENTRY
317art_lock_object_from_code:
318 SETUP_REF_ONLY_CALLEE_SAVE_FRAME // save ref containing registers for GC
319 mov %esp, %edx // remember SP
320 // Outgoing argument set up
321 pushl %eax // alignment padding
322 pushl %edx // pass SP
323 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
324 pushl %eax // pass arg1
325 call artLockObjectFromCode // (Object*, Thread*, SP)
326 addl LITERAL(16), %esp // pop arguments
327 RESTORE_REF_ONLY_CALLEE_SAVE_FRAME // restore frame up to return address
328 ret
329
330 .globl art_unlock_object_from_code
331 ALIGN_FUNCTION_ENTRY
332art_unlock_object_from_code:
333 SETUP_REF_ONLY_CALLEE_SAVE_FRAME // save ref containing registers for GC
334 mov %esp, %edx // remember SP
335 // Outgoing argument set up
336 pushl %eax // alignment padding
337 pushl %edx // pass SP
338 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
339 pushl %eax // pass arg1
340 call artUnlockObjectFromCode // (Object*, Thread*, SP)
341 addl LITERAL(16), %esp // pop arguments
342 RESTORE_REF_ONLY_CALLEE_SAVE_FRAME // restore frame up to return address
343 testl %eax, %eax // eax == 0 ?
344 jnz 1f
345 ret
3461:
347 DELIVER_PENDING_EXCEPTION
348
349 .globl art_handle_fill_data_from_code
350 ALIGN_FUNCTION_ENTRY
351art_handle_fill_data_from_code:
352 SETUP_REF_ONLY_CALLEE_SAVE_FRAME // save ref containing registers for GC
353 mov %esp, %edx // remember SP
354 // Outgoing argument set up
355 pushl %edx // pass SP
356 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
357 pushl %ecx // pass arg2
358 pushl %eax // pass arg1
359 call artHandleFillArrayDataFromCode // (Array* array, const uint16_t* table, Thread*, SP)
360 addl LITERAL(16), %esp // pop arguments
361 RESTORE_REF_ONLY_CALLEE_SAVE_FRAME // restore frame up to return address
362 testl %eax, %eax // eax == 0 ?
363 jnz 1f
364 ret
3651:
366 DELIVER_PENDING_EXCEPTION
367
368 .globl art_is_assignable_from_code
369 ALIGN_FUNCTION_ENTRY
370art_is_assignable_from_code:
371 pushl %eax // alignment padding
372 pushl %ecx // pass arg2
373 pushl %eax // pass arg1
374 call artIsAssignableFromCode // (Class* a, Class* b, Thread*, SP)
375 addl LITERAL(12), %esp // pop arguments
376 ret
377
378 .globl art_memcpy
379 ALIGN_FUNCTION_ENTRY
380art_memcpy:
381 pushl %edx // pass arg3
382 pushl %ecx // pass arg2
383 pushl %eax // pass arg1
384 call memcpy // (void*, const void*, size_t)
385 addl LITERAL(12), %esp // pop arguments
386 ret
387
388 .globl art_check_cast_from_code
389 ALIGN_FUNCTION_ENTRY
390art_check_cast_from_code:
391 SETUP_REF_ONLY_CALLEE_SAVE_FRAME // save ref containing registers for GC
392 mov %esp, %edx // remember SP
393 // Outgoing argument set up
394 pushl %edx // pass SP
395 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
396 pushl %ecx // pass arg2
397 pushl %eax // pass arg1
398 call artCheckCastFromCode // (Class* a, Class* b, Thread*, SP)
399 addl LITERAL(16), %esp // pop arguments
400 RESTORE_REF_ONLY_CALLEE_SAVE_FRAME // restore frame up to return address
401 testl %eax, %eax // eax == 0 ?
402 jnz 1f
403 ret
4041:
405 DELIVER_PENDING_EXCEPTION
406
407 .globl art_idiv_from_code
408 ALIGN_FUNCTION_ENTRY
409art_idiv_from_code:
410 cdq // edx:eax = sign extend eax
411 idiv %ecx // (edx,eax) = (edx:eax % ecx, edx:eax / ecx)
412 ret
413
414 .globl art_idivmod_from_code
415 ALIGN_FUNCTION_ENTRY
416art_idivmod_from_code:
417 cdq // edx:eax = sign extend eax
418 idiv %ecx // (edx,eax) = (edx:eax % ecx, edx:eax / ecx)
419 movl %eax, %edx
420 ret
421
422 .globl art_can_put_array_element_from_code
423 ALIGN_FUNCTION_ENTRY
424art_can_put_array_element_from_code:
425 test %eax, %eax // Null is trivially storable
426 jz 1f
427 SETUP_REF_ONLY_CALLEE_SAVE_FRAME // save ref containing registers for GC
428 mov %esp, %edx // remember SP
429 // Outgoing argument set up
430 pushl %edx // pass SP
431 pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current()
432 pushl %ecx // pass arg2
433 pushl %eax // pass arg1
434 call artCanPutArrayElementFromCode // (Object* element, Class* array_class, Thread*, SP)
435 addl LITERAL(16), %esp // pop arguments
436 RESTORE_REF_ONLY_CALLEE_SAVE_FRAME // restore frame up to return address
437 testl %eax, %eax // eax == 0 ?
438 jnz 2f
4391:
440 ret
4412:
442 DELIVER_PENDING_EXCEPTION
443
Elliott Hughes787ec202012-03-29 17:14:15 -0700444MACRO1(UNIMPLEMENTED,name)
445 .globl VAR(name, 0)
446 ALIGN_FUNCTION_ENTRY
447VAR(name, 0):
Ian Rogers57b86d42012-03-27 16:05:41 -0700448 int3
Elliott Hughes787ec202012-03-29 17:14:15 -0700449END_MACRO
Ian Rogers57b86d42012-03-27 16:05:41 -0700450
Elliott Hughes787ec202012-03-29 17:14:15 -0700451 // TODO: implement these!
452UNIMPLEMENTED art_proxy_invoke_handler
453UNIMPLEMENTED art_update_debugger
454UNIMPLEMENTED art_test_suspend
Elliott Hughes787ec202012-03-29 17:14:15 -0700455UNIMPLEMENTED art_initialize_type_and_verify_access_from_code
456UNIMPLEMENTED art_initialize_type_from_code
Elliott Hughes787ec202012-03-29 17:14:15 -0700457UNIMPLEMENTED art_set32_instance_from_code
458UNIMPLEMENTED art_set64_instance_from_code
459UNIMPLEMENTED art_set_obj_instance_from_code
460UNIMPLEMENTED art_get32_instance_from_code
461UNIMPLEMENTED art_get64_instance_from_code
462UNIMPLEMENTED art_get_obj_instance_from_code
463UNIMPLEMENTED art_set32_static_from_code
464UNIMPLEMENTED art_set64_static_from_code
465UNIMPLEMENTED art_set_obj_static_from_code
466UNIMPLEMENTED art_get32_static_from_code
467UNIMPLEMENTED art_get64_static_from_code
468UNIMPLEMENTED art_get_obj_static_from_code
Elliott Hughes787ec202012-03-29 17:14:15 -0700469UNIMPLEMENTED art_indexof
Ian Rogers7caad772012-03-30 01:07:54 -0700470UNIMPLEMENTED art_memcmp16
Elliott Hughes787ec202012-03-29 17:14:15 -0700471UNIMPLEMENTED art_string_compareto