Home | History | Annotate | Download | only in llvm
      1 /*
      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 
     17 // DEF_INTRINSICS_FUNC(ID, NAME, ATTR, RET_TYPE,
     18 //                     ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE)
     19 #ifndef DEF_INTRINSICS_FUNC
     20 #  error "missing DEF_INTRINSICS_FUNC definition!"
     21 #endif
     22 
     23 #define _EVAL_DEF_INTRINSICS_FUNC(ID, NAME, ATTR, RET_TYPE, ...) \
     24     DEF_INTRINSICS_FUNC(ID, NAME, ATTR, RET_TYPE, __VA_ARGS__)
     25 
     26 #define _EXPAND_ARG0()                         kNone, kNone, kNone, kNone, kNone
     27 #define _EXPAND_ARG1(ARG1)                      ARG1, kNone, kNone, kNone, kNone
     28 #define _EXPAND_ARG2(ARG1, ARG2)                ARG1,  ARG2, kNone, kNone, kNone
     29 #define _EXPAND_ARG3(ARG1, ARG2, ARG3)          ARG1,  ARG2,  ARG3, kNone, kNone
     30 #define _EXPAND_ARG4(ARG1, ARG2, ARG3, ARG4)    ARG1,  ARG2,  ARG3,  ARG4, kNone
     31 #define _EXPAND_ARG5(ARG1, ARG2, ARG3, ARG4, ARG5) \
     32                                                 ARG1,  ARG2,  ARG3,  ARG4,  ARG5
     33 
     34 #define _JTYPE(TYPE, SPACE) _JTYPE_OF_ ## TYPE ## _UNDER_ ## SPACE
     35 
     36 // Note: These should be consistent with the type return from
     37 // IRBuilder::GetJType([type], kArray).
     38 #define _JTYPE_OF_kInt1Ty_UNDER_kArray        kInt8Ty
     39 #define _JTYPE_OF_kInt8Ty_UNDER_kArray        kInt8Ty
     40 #define _JTYPE_OF_kInt16Ty_UNDER_kArray       kInt16Ty
     41 #define _JTYPE_OF_kInt32Ty_UNDER_kArray       kInt32Ty
     42 #define _JTYPE_OF_kInt64Ty_UNDER_kArray       kInt64Ty
     43 #define _JTYPE_OF_kJavaObjectTy_UNDER_kArray  kJavaObjectTy
     44 
     45 // Note: These should be consistent with the type return from
     46 // IRBuilder::GetJType([type], kField).
     47 #define _JTYPE_OF_kInt1Ty_UNDER_kField        kInt32Ty
     48 #define _JTYPE_OF_kInt8Ty_UNDER_kField        kInt32Ty
     49 #define _JTYPE_OF_kInt16Ty_UNDER_kField       kInt32Ty
     50 #define _JTYPE_OF_kInt32Ty_UNDER_kField       kInt32Ty
     51 #define _JTYPE_OF_kInt64Ty_UNDER_kField       kInt64Ty
     52 #define _JTYPE_OF_kJavaObjectTy_UNDER_kField  kJavaObjectTy
     53 
     54 //----------------------------------------------------------------------------
     55 // Thread
     56 //----------------------------------------------------------------------------
     57 
     58 // Thread* art_portable_get_current_thread()
     59 _EVAL_DEF_INTRINSICS_FUNC(GetCurrentThread,
     60                           art_portable_get_current_thread,
     61                           kAttrReadNone | kAttrNoThrow,
     62                           kJavaThreadTy,
     63                           _EXPAND_ARG0())
     64 
     65 // void art_portable_test_suspend(Thread* thread)
     66 _EVAL_DEF_INTRINSICS_FUNC(TestSuspend,
     67                           art_portable_test_suspend,
     68                           kAttrNoThrow,
     69                           kVoidTy,
     70                           _EXPAND_ARG1(kJavaThreadTy))
     71 
     72 // void art_portable_check_suspend() /* Expands to GetCurrentThread/TestSuspend */
     73 _EVAL_DEF_INTRINSICS_FUNC(CheckSuspend,
     74                           art_portable_check_suspend,
     75                           kAttrNoThrow,
     76                           kVoidTy,
     77                           _EXPAND_ARG0())
     78 
     79 // void art_portable_mark_gc_card(Object* new_value, Object* object)
     80 _EVAL_DEF_INTRINSICS_FUNC(MarkGCCard,
     81                           art_portable_mark_gc_card,
     82                           kAttrNoThrow,
     83                           kVoidTy,
     84                           _EXPAND_ARG2(kJavaObjectTy, kJavaObjectTy))
     85 
     86 //----------------------------------------------------------------------------
     87 // Exception
     88 //----------------------------------------------------------------------------
     89 
     90 // Should not expand - introduces the catch targets for a potentially
     91 // throwing instruction.  The result is a switch key and this
     92 // instruction will be followed by a switch statement.  The catch
     93 // targets will be enumerated as cases of the switch, with the fallthrough
     94 // designating the block containing the potentially throwing instruction.
     95 // bool art_portable_catch_targets(int dex_pc)
     96 _EVAL_DEF_INTRINSICS_FUNC(CatchTargets,
     97                           art_portable_catch_targets,
     98                           kAttrReadOnly | kAttrNoThrow,
     99                           kInt32Ty,
    100                           _EXPAND_ARG1(kInt32ConstantTy))
    101 
    102 // void art_portable_throw_exception(JavaObject* exception)
    103 _EVAL_DEF_INTRINSICS_FUNC(ThrowException,
    104                           art_portable_throw_exception,
    105                           kAttrDoThrow,
    106                           kVoidTy,
    107                           _EXPAND_ARG1(kJavaObjectTy))
    108 
    109 // void art_portable_hl_throw_exception(JavaObject* exception)
    110 _EVAL_DEF_INTRINSICS_FUNC(HLThrowException,
    111                           art_portable_hl_throw_exception,
    112                           kAttrDoThrow,
    113                           kVoidTy,
    114                           _EXPAND_ARG1(kJavaObjectTy))
    115 
    116 // JavaObject* art_portable_get_current_exception()
    117 _EVAL_DEF_INTRINSICS_FUNC(GetException,
    118                           art_portable_get_current_exception,
    119                           kAttrReadOnly | kAttrNoThrow,
    120                           kJavaObjectTy,
    121                           _EXPAND_ARG0())
    122 
    123 // bool art_portable_is_exception_pending()
    124 _EVAL_DEF_INTRINSICS_FUNC(IsExceptionPending,
    125                           art_portable_is_exception_pending,
    126                           kAttrReadOnly | kAttrNoThrow,
    127                           kInt1Ty,
    128                           _EXPAND_ARG0())
    129 
    130 // int art_portable_find_catch_block(Method* method, int try_item_offset)
    131 _EVAL_DEF_INTRINSICS_FUNC(FindCatchBlock,
    132                           art_portable_find_catch_block,
    133                           kAttrReadOnly | kAttrNoThrow,
    134                           kInt32Ty,
    135                           _EXPAND_ARG2(kJavaMethodTy, kInt32ConstantTy))
    136 
    137 // void art_portable_throw_div_zero()
    138 _EVAL_DEF_INTRINSICS_FUNC(ThrowDivZeroException,
    139                           art_portable_throw_div_zero,
    140                           kAttrDoThrow,
    141                           kVoidTy,
    142                           _EXPAND_ARG0())
    143 
    144 // void art_portable_throw_null_pointer_exception(uint32_t dex_pc)
    145 _EVAL_DEF_INTRINSICS_FUNC(ThrowNullPointerException,
    146                           art_portable_throw_null_pointer_exception,
    147                           kAttrDoThrow,
    148                           kVoidTy,
    149                           _EXPAND_ARG1(kInt32ConstantTy))
    150 
    151 // void art_portable_throw_array_bounds(int index, int array_len)
    152 _EVAL_DEF_INTRINSICS_FUNC(ThrowIndexOutOfBounds,
    153                           art_portable_throw_array_bounds,
    154                           kAttrDoThrow,
    155                           kVoidTy,
    156                           _EXPAND_ARG2(kInt32Ty, kInt32Ty))
    157 
    158 //----------------------------------------------------------------------------
    159 // ConstString
    160 //----------------------------------------------------------------------------
    161 
    162 // JavaObject* art_portable_const_string(uint32_t string_idx)
    163 _EVAL_DEF_INTRINSICS_FUNC(ConstString,
    164                           art_portable_const_string,
    165                           kAttrReadOnly | kAttrNoThrow,
    166                           kJavaObjectTy,
    167                           _EXPAND_ARG1(kInt32ConstantTy))
    168 
    169 // JavaObject* art_portable_load_string_from_dex_cache(Method* method, uint32_t string_idx)
    170 _EVAL_DEF_INTRINSICS_FUNC(LoadStringFromDexCache,
    171                           art_portable_load_string_from_dex_cache,
    172                           kAttrReadOnly | kAttrNoThrow,
    173                           kJavaObjectTy,
    174                           _EXPAND_ARG1(kInt32ConstantTy))
    175 
    176 // JavaObject* art_portable_resolve_string(Method* method, uint32_t string_idx)
    177 _EVAL_DEF_INTRINSICS_FUNC(ResolveString,
    178                           art_portable_resolve_string,
    179                           kAttrNone,
    180                           kJavaObjectTy,
    181                           _EXPAND_ARG2(kJavaMethodTy, kInt32ConstantTy))
    182 
    183 //----------------------------------------------------------------------------
    184 // ConstClass
    185 //----------------------------------------------------------------------------
    186 
    187 // JavaObject* art_portable_const_class(uint32_t type_idx)
    188 _EVAL_DEF_INTRINSICS_FUNC(ConstClass,
    189                           art_portable_const_class,
    190                           kAttrReadOnly | kAttrNoThrow,
    191                           kJavaObjectTy,
    192                           _EXPAND_ARG1(kInt32ConstantTy))
    193 
    194 // JavaObject* art_portable_initialize_type_and_verify_access(uint32_t type_idx,
    195 //                                                        Method* referrer,
    196 //                                                        Thread* thread)
    197 _EVAL_DEF_INTRINSICS_FUNC(InitializeTypeAndVerifyAccess,
    198                           art_portable_initialize_type_and_verify_access,
    199                           kAttrNone,
    200                           kJavaObjectTy,
    201                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy))
    202 
    203 // JavaObject* art_portable_load_type_from_dex_cache(uint32_t type_idx)
    204 _EVAL_DEF_INTRINSICS_FUNC(LoadTypeFromDexCache,
    205                           art_portable_load_type_from_dex_cache,
    206                           kAttrReadOnly | kAttrNoThrow,
    207                           kJavaObjectTy,
    208                           _EXPAND_ARG1(kInt32ConstantTy))
    209 
    210 // JavaObject* art_portable_initialize_type(uint32_t type_idx,
    211 //                                      Method* referrer,
    212 //                                      Thread* thread)
    213 _EVAL_DEF_INTRINSICS_FUNC(InitializeType,
    214                           art_portable_initialize_type,
    215                           kAttrNone,
    216                           kJavaObjectTy,
    217                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy))
    218 
    219 //----------------------------------------------------------------------------
    220 // Lock
    221 //----------------------------------------------------------------------------
    222 
    223 // void art_portable_lock_object(JavaObject* obj, Thread* thread)
    224 _EVAL_DEF_INTRINSICS_FUNC(LockObject,
    225                           art_portable_lock_object,
    226                           kAttrNoThrow,
    227                           kVoidTy,
    228                           _EXPAND_ARG2(kJavaObjectTy, kJavaThreadTy))
    229 
    230 // void art_portable_unlock_object(JavaObject* obj, Thread* thread)
    231 _EVAL_DEF_INTRINSICS_FUNC(UnlockObject,
    232                           art_portable_unlock_object,
    233                           kAttrNone,
    234                           kVoidTy,
    235                           _EXPAND_ARG2(kJavaObjectTy, kJavaThreadTy))
    236 
    237 //----------------------------------------------------------------------------
    238 // Cast
    239 //----------------------------------------------------------------------------
    240 
    241 // void art_portable_check_cast(JavaObject* dest_type, JavaObject* src_type)
    242 _EVAL_DEF_INTRINSICS_FUNC(CheckCast,
    243                           art_portable_check_cast,
    244                           kAttrNone,
    245                           kVoidTy,
    246                           _EXPAND_ARG2(kJavaObjectTy, kJavaObjectTy))
    247 
    248 // void art_portable_hl_check_cast(uint32_t type_idx, JavaObject* obj)
    249 _EVAL_DEF_INTRINSICS_FUNC(HLCheckCast,
    250                           art_portable_hl_check_cast,
    251                           kAttrReadOnly | kAttrNoThrow,
    252                           kVoidTy,
    253                           _EXPAND_ARG2(kInt32ConstantTy, kJavaObjectTy))
    254 
    255 // int art_portable_is_assignable(JavaObject* dest_type, JavaObject* src_type)
    256 _EVAL_DEF_INTRINSICS_FUNC(IsAssignable,
    257                           art_portable_is_assignable,
    258                           kAttrReadOnly | kAttrNoThrow,
    259                           kInt32Ty,
    260                           _EXPAND_ARG2(kJavaObjectTy, kJavaObjectTy))
    261 
    262 //----------------------------------------------------------------------------
    263 // Allocation
    264 //----------------------------------------------------------------------------
    265 
    266 // JavaObject* art_portable_alloc_object(uint32_t type_idx,
    267 //                                   Method* referrer,
    268 //                                   Thread* thread)
    269 _EVAL_DEF_INTRINSICS_FUNC(AllocObject,
    270                           art_portable_alloc_object,
    271                           kAttrNone,
    272                           kJavaObjectTy,
    273                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy))
    274 
    275 // JavaObject* art_portable_alloc_object_with_access_check(uint32_t type_idx,
    276 //                                                     Method* referrer,
    277 //                                                     Thread* thread)
    278 _EVAL_DEF_INTRINSICS_FUNC(AllocObjectWithAccessCheck,
    279                           art_portable_alloc_object_with_access_check,
    280                           kAttrNone,
    281                           kJavaObjectTy,
    282                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy))
    283 
    284 //----------------------------------------------------------------------------
    285 // Instance
    286 //----------------------------------------------------------------------------
    287 
    288 // JavaObject* art_portable_new_instance(uint32_t type_idx)
    289 _EVAL_DEF_INTRINSICS_FUNC(NewInstance,
    290                           art_portable_new_instance,
    291                           kAttrNone,
    292                           kJavaObjectTy,
    293                           _EXPAND_ARG1(kInt32Ty))
    294 
    295 // bool art_portable_instance_of(uint32_t type_idx, JavaObject* ref)
    296 _EVAL_DEF_INTRINSICS_FUNC(InstanceOf,
    297                           art_portable_instance_of,
    298                           kAttrNone,
    299                           kInt32Ty,
    300                           _EXPAND_ARG2(kInt32Ty, kJavaObjectTy))
    301 
    302 //----------------------------------------------------------------------------
    303 // Array
    304 //----------------------------------------------------------------------------
    305 
    306 // JavaObject* art_portable_new_array(uint32_t type_idx, uint32_t array_size)
    307 _EVAL_DEF_INTRINSICS_FUNC(NewArray,
    308                           art_portable_new_array,
    309                           kAttrNone,
    310                           kJavaObjectTy,
    311                           _EXPAND_ARG2(kInt32ConstantTy, kInt32Ty))
    312 
    313 // uint32_t art_portable_opt_array_length(int32_t opt_flags, JavaObject* array)
    314 _EVAL_DEF_INTRINSICS_FUNC(OptArrayLength,
    315                           art_portable_opt_array_length,
    316                           kAttrReadOnly | kAttrNoThrow,
    317                           kInt32Ty,
    318                           _EXPAND_ARG2(kInt32Ty, kJavaObjectTy))
    319 
    320 // uint32_t art_portable_array_length(JavaObject* array)
    321 _EVAL_DEF_INTRINSICS_FUNC(ArrayLength,
    322                           art_portable_array_length,
    323                           kAttrReadOnly | kAttrNoThrow,
    324                           kInt32Ty,
    325                           _EXPAND_ARG1(kJavaObjectTy))
    326 
    327 // JavaObject* art_portable_alloc_array(uint32_t type_idx,
    328 //                                  Method* referrer,
    329 //                                  uint32_t length,
    330 //                                  Thread* thread)
    331 _EVAL_DEF_INTRINSICS_FUNC(AllocArray,
    332                           art_portable_alloc_array,
    333                           kAttrNone,
    334                           kJavaObjectTy,
    335                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kInt32Ty, kJavaThreadTy))
    336 
    337 // JavaObject* art_portable_alloc_array_with_access_check(uint32_t type_idx,
    338 //                                                    Method* referrer,
    339 //                                                    uint32_t length,
    340 //                                                    Thread* thread)
    341 _EVAL_DEF_INTRINSICS_FUNC(AllocArrayWithAccessCheck,
    342                           art_portable_alloc_array_with_access_check,
    343                           kAttrNone,
    344                           kJavaObjectTy,
    345                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kInt32Ty, kJavaThreadTy))
    346 
    347 // JavaObject* art_portable_check_and_alloc_array(uint32_t type_idx,
    348 //                                            Method* referrer,
    349 //                                            uint32_t length,
    350 //                                            Thread* thread)
    351 _EVAL_DEF_INTRINSICS_FUNC(CheckAndAllocArray,
    352                           art_portable_check_and_alloc_array,
    353                           kAttrNone,
    354                           kJavaObjectTy,
    355                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kInt32ConstantTy, kJavaThreadTy))
    356 
    357 // JavaObject* art_portable_check_and_alloc_array_with_access_check(uint32_t type_idx,
    358 //                                                              Method* referrer,
    359 //                                                              uint32_t length,
    360 //                                                              Thread* thread)
    361 _EVAL_DEF_INTRINSICS_FUNC(CheckAndAllocArrayWithAccessCheck,
    362                           art_portable_check_and_alloc_array_with_access_check,
    363                           kAttrNone,
    364                           kJavaObjectTy,
    365                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kInt32ConstantTy, kJavaThreadTy))
    366 
    367 // art_portable_aget_* and art_portable_aput_* never generate exception since the
    368 // necessary checking on arguments (e.g., array and index) has already done
    369 // before invocation of these intrinsics.
    370 //
    371 // [type] void art_portable_aget_[type](JavaObject* array, uint32_t index)
    372 _EVAL_DEF_INTRINSICS_FUNC(ArrayGet,
    373                           art_portable_aget,
    374                           kAttrReadOnly | kAttrNoThrow,
    375                           _JTYPE(kInt32Ty, kArray),
    376                           _EXPAND_ARG2(kJavaObjectTy, kInt32Ty))
    377 
    378 _EVAL_DEF_INTRINSICS_FUNC(ArrayGetWide,
    379                           art_portable_aget_wide,
    380                           kAttrReadOnly | kAttrNoThrow,
    381                           _JTYPE(kInt64Ty, kArray),
    382                           _EXPAND_ARG2(kJavaObjectTy, kInt32Ty))
    383 
    384 _EVAL_DEF_INTRINSICS_FUNC(ArrayGetObject,
    385                           art_portable_aget_object,
    386                           kAttrReadOnly | kAttrNoThrow,
    387                           _JTYPE(kJavaObjectTy, kArray),
    388                           _EXPAND_ARG2(kJavaObjectTy, kInt32Ty))
    389 
    390 _EVAL_DEF_INTRINSICS_FUNC(ArrayGetBoolean,
    391                           art_portable_aget_boolean,
    392                           kAttrReadOnly | kAttrNoThrow,
    393                           _JTYPE(kInt1Ty, kArray),
    394                           _EXPAND_ARG2(kJavaObjectTy, kInt32Ty))
    395 
    396 _EVAL_DEF_INTRINSICS_FUNC(ArrayGetByte,
    397                           art_portable_aget_byte,
    398                           kAttrReadOnly | kAttrNoThrow,
    399                           _JTYPE(kInt8Ty, kArray),
    400                           _EXPAND_ARG2(kJavaObjectTy, kInt32Ty))
    401 
    402 _EVAL_DEF_INTRINSICS_FUNC(ArrayGetChar,
    403                           art_portable_aget_char,
    404                           kAttrReadOnly | kAttrNoThrow,
    405                           _JTYPE(kInt16Ty, kArray),
    406                           _EXPAND_ARG2(kJavaObjectTy, kInt32Ty))
    407 
    408 _EVAL_DEF_INTRINSICS_FUNC(ArrayGetShort,
    409                           art_portable_aget_short,
    410                           kAttrReadOnly | kAttrNoThrow,
    411                           _JTYPE(kInt16Ty, kArray),
    412                           _EXPAND_ARG2(kJavaObjectTy, kInt32Ty))
    413 
    414 // void art_portable_aput_[type]([type] value, JavaObject* array, uint32_t index)
    415 _EVAL_DEF_INTRINSICS_FUNC(ArrayPut,
    416                           art_portable_aput,
    417                           kAttrNoThrow,
    418                           kVoidTy,
    419                           _EXPAND_ARG3(_JTYPE(kInt32Ty, kArray), kJavaObjectTy, kInt32Ty))
    420 
    421 _EVAL_DEF_INTRINSICS_FUNC(ArrayPutWide,
    422                           art_portable_aput_wide,
    423                           kAttrNoThrow,
    424                           kVoidTy,
    425                           _EXPAND_ARG3(_JTYPE(kInt64Ty, kArray), kJavaObjectTy, kInt32Ty))
    426 
    427 _EVAL_DEF_INTRINSICS_FUNC(ArrayPutObject,
    428                           art_portable_aput_object,
    429                           kAttrNoThrow,
    430                           kVoidTy,
    431                           _EXPAND_ARG3(_JTYPE(kJavaObjectTy, kArray), kJavaObjectTy, kInt32Ty))
    432 
    433 _EVAL_DEF_INTRINSICS_FUNC(ArrayPutBoolean,
    434                           art_portable_aput_boolean,
    435                           kAttrNoThrow,
    436                           kVoidTy,
    437                           _EXPAND_ARG3(_JTYPE(kInt1Ty, kArray), kJavaObjectTy, kInt32Ty))
    438 
    439 _EVAL_DEF_INTRINSICS_FUNC(ArrayPutByte,
    440                           art_portable_aput_byte,
    441                           kAttrNoThrow,
    442                           kVoidTy,
    443                           _EXPAND_ARG3(_JTYPE(kInt8Ty, kArray), kJavaObjectTy, kInt32Ty))
    444 
    445 _EVAL_DEF_INTRINSICS_FUNC(ArrayPutChar,
    446                           art_portable_aput_char,
    447                           kAttrNoThrow,
    448                           kVoidTy,
    449                           _EXPAND_ARG3(_JTYPE(kInt16Ty, kArray), kJavaObjectTy, kInt32Ty))
    450 
    451 _EVAL_DEF_INTRINSICS_FUNC(ArrayPutShort,
    452                           art_portable_aput_short,
    453                           kAttrNoThrow,
    454                           kVoidTy,
    455                           _EXPAND_ARG3(_JTYPE(kInt16Ty, kArray), kJavaObjectTy, kInt32Ty))
    456 
    457 // void art_portable_check_put_array_element(JavaObject* value, JavaObject* array)
    458 _EVAL_DEF_INTRINSICS_FUNC(CheckPutArrayElement,
    459                           art_portable_check_put_array_element,
    460                           kAttrNone,
    461                           kVoidTy,
    462                           _EXPAND_ARG2(kJavaObjectTy, kJavaObjectTy))
    463 
    464 // void art_portable_filled_new_array(Array* array,
    465 //                                uint32_t elem_jty, ...)
    466 _EVAL_DEF_INTRINSICS_FUNC(FilledNewArray,
    467                           art_portable_filled_new_array,
    468                           kAttrNoThrow,
    469                           kVoidTy,
    470                           _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kVarArgTy))
    471 
    472 // void art_portable_fill_array_data(Method* referrer,
    473 //                               uint32_t dex_pc,
    474 //                               Array* array,
    475 //                               uint32_t payload_offset)
    476 _EVAL_DEF_INTRINSICS_FUNC(FillArrayData,
    477                           art_portable_fill_array_data,
    478                           kAttrNone,
    479                           kVoidTy,
    480                           _EXPAND_ARG4(kJavaMethodTy, kInt32ConstantTy, kJavaObjectTy, kInt32ConstantTy))
    481 
    482 // void art_portable_hl_fill_array_data(int32_t offset, JavaObject* array)
    483 _EVAL_DEF_INTRINSICS_FUNC(HLFillArrayData,
    484                           art_portable_hl_fill_array_data,
    485                           kAttrNone,
    486                           kVoidTy,
    487                           _EXPAND_ARG2(kInt32ConstantTy, kJavaObjectTy))
    488 
    489 //----------------------------------------------------------------------------
    490 // Instance Field
    491 //----------------------------------------------------------------------------
    492 
    493 // [type] art_portable_iget_[type](uint32_t field_idx,
    494 //                             Method* referrer,
    495 //                             JavaObject* obj)
    496 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGet,
    497                           art_portable_iget,
    498                           kAttrNone,
    499                           _JTYPE(kInt32Ty, kField),
    500                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy))
    501 
    502 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetWide,
    503                           art_portable_iget_wide,
    504                           kAttrNone,
    505                           _JTYPE(kInt64Ty, kField),
    506                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy))
    507 
    508 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetObject,
    509                           art_portable_iget_object,
    510                           kAttrNone,
    511                           _JTYPE(kJavaObjectTy, kField),
    512                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy))
    513 
    514 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetBoolean,
    515                           art_portable_iget_boolean,
    516                           kAttrNone,
    517                           _JTYPE(kInt1Ty, kField),
    518                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy))
    519 
    520 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetByte,
    521                           art_portable_iget_byte,
    522                           kAttrNone,
    523                           _JTYPE(kInt8Ty, kField),
    524                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy))
    525 
    526 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetChar,
    527                           art_portable_iget_char,
    528                           kAttrNone,
    529                           _JTYPE(kInt16Ty, kField),
    530                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy))
    531 
    532 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetShort,
    533                           art_portable_iget_short,
    534                           kAttrNone,
    535                           _JTYPE(kInt16Ty, kField),
    536                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy))
    537 
    538 // [type] art_portable_iget_[type].fast(int field_offset,
    539 //                                  bool is_volatile,
    540 //                                  JavaObject* obj)
    541 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetFast,
    542                           art_portable_iget.fast,
    543                           kAttrReadOnly | kAttrNoThrow,
    544                           _JTYPE(kInt32Ty, kField),
    545                           _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy))
    546 
    547 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetWideFast,
    548                           art_portable_iget_wide.fast,
    549                           kAttrReadOnly | kAttrNoThrow,
    550                           _JTYPE(kInt64Ty, kField),
    551                           _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy))
    552 
    553 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetObjectFast,
    554                           art_portable_iget_object.fast,
    555                           kAttrReadOnly | kAttrNoThrow,
    556                           _JTYPE(kJavaObjectTy, kField),
    557                           _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy))
    558 
    559 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetBooleanFast,
    560                           art_portable_iget_boolean.fast,
    561                           kAttrReadOnly | kAttrNoThrow,
    562                           _JTYPE(kInt1Ty, kField),
    563                           _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy))
    564 
    565 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetByteFast,
    566                           art_portable_iget_byte.fast,
    567                           kAttrReadOnly | kAttrNoThrow,
    568                           _JTYPE(kInt8Ty, kField),
    569                           _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy))
    570 
    571 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetCharFast,
    572                           art_portable_iget_char.fast,
    573                           kAttrReadOnly | kAttrNoThrow,
    574                           _JTYPE(kInt16Ty, kField),
    575                           _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy))
    576 
    577 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetShortFast,
    578                           art_portable_iget_short.fast,
    579                           kAttrReadOnly | kAttrNoThrow,
    580                           _JTYPE(kInt16Ty, kField),
    581                           _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy))
    582 
    583 // void art_portable_iput_[type](uint32_t field_idx,
    584 //                           Method* referrer,
    585 //                           JavaObject* obj,
    586 //                           [type] new_value)
    587 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPut,
    588                           art_portable_iput,
    589                           kAttrNone,
    590                           kVoidTy,
    591                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt32Ty, kField)))
    592 
    593 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutWide,
    594                           art_portable_iput_wide,
    595                           kAttrNone,
    596                           kVoidTy,
    597                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt64Ty, kField)))
    598 
    599 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutObject,
    600                           art_portable_iput_object,
    601                           kAttrNone,
    602                           kVoidTy,
    603                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kJavaObjectTy, kField)))
    604 
    605 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutBoolean,
    606                           art_portable_iput_boolean,
    607                           kAttrNone,
    608                           kVoidTy,
    609                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt1Ty, kField)))
    610 
    611 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutByte,
    612                           art_portable_iput_byte,
    613                           kAttrNone,
    614                           kVoidTy,
    615                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt8Ty, kField)))
    616 
    617 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutChar,
    618                           art_portable_iput_char,
    619                           kAttrNone,
    620                           kVoidTy,
    621                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt16Ty, kField)))
    622 
    623 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutShort,
    624                           art_portable_iput_short,
    625                           kAttrNone,
    626                           kVoidTy,
    627                           _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt16Ty, kField)))
    628 
    629 // void art_portable_iput_[type].fast(int field_offset,
    630 //                                bool is_volatile,
    631 //                                JavaObject* obj,
    632 //                                [type] new_value)
    633 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutFast,
    634                           art_portable_iput.fast,
    635                           kAttrNoThrow,
    636                           kVoidTy,
    637                           _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt32Ty, kField)))
    638 
    639 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutWideFast,
    640                           art_portable_iput_wide.fast,
    641                           kAttrNoThrow,
    642                           kVoidTy,
    643                           _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt64Ty, kField)))
    644 
    645 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutObjectFast,
    646                           art_portable_iput_object.fast,
    647                           kAttrNoThrow,
    648                           kVoidTy,
    649                           _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kJavaObjectTy, kField)))
    650 
    651 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutBooleanFast,
    652                           art_portable_iput_boolean.fast,
    653                           kAttrNoThrow,
    654                           kVoidTy,
    655                           _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt1Ty, kField)))
    656 
    657 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutByteFast,
    658                           art_portable_iput_byte.fast,
    659                           kAttrNoThrow,
    660                           kVoidTy,
    661                           _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt8Ty, kField)))
    662 
    663 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutCharFast,
    664                           art_portable_iput_char.fast,
    665                           kAttrNoThrow,
    666                           kVoidTy,
    667                           _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt16Ty, kField)))
    668 
    669 _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutShortFast,
    670                           art_portable_iput_short.fast,
    671                           kAttrNoThrow,
    672                           kVoidTy,
    673                           _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt16Ty, kField)))
    674 
    675 //----------------------------------------------------------------------------
    676 // Static Field
    677 //----------------------------------------------------------------------------
    678 
    679 // [type] art_portable_sget_[type](uint32_t field_idx, Method* referrer)
    680 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGet,
    681                           art_portable_sget,
    682                           kAttrNone,
    683                           _JTYPE(kInt32Ty, kField),
    684                           _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy))
    685 
    686 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetWide,
    687                           art_portable_sget_wide,
    688                           kAttrNone,
    689                           _JTYPE(kInt64Ty, kField),
    690                           _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy))
    691 
    692 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetObject,
    693                           art_portable_sget_object,
    694                           kAttrNone,
    695                           _JTYPE(kJavaObjectTy, kField),
    696                           _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy))
    697 
    698 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetBoolean,
    699                           art_portable_sget_boolean,
    700                           kAttrNone,
    701                           _JTYPE(kInt1Ty, kField),
    702                           _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy))
    703 
    704 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetByte,
    705                           art_portable_sget_byte,
    706                           kAttrNone,
    707                           _JTYPE(kInt8Ty, kField),
    708                           _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy))
    709 
    710 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetChar,
    711                           art_portable_sget_char,
    712                           kAttrNone,
    713                           _JTYPE(kInt16Ty, kField),
    714                           _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy))
    715 
    716 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetShort,
    717                           art_portable_sget_short,
    718                           kAttrNone,
    719                           _JTYPE(kInt16Ty, kField),
    720                           _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy))
    721 
    722 // [type] art_portable_sget_[type].fast(JavaObject* ssb,
    723 //                                  int field_offset,
    724 //                                  bool is_volatile)
    725 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetFast,
    726                           art_portable_sget.fast,
    727                           kAttrReadOnly | kAttrNoThrow,
    728                           _JTYPE(kInt32Ty, kField),
    729                           _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy))
    730 
    731 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetWideFast,
    732                           art_portable_sget_wide.fast,
    733                           kAttrReadOnly | kAttrNoThrow,
    734                           _JTYPE(kInt64Ty, kField),
    735                           _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy))
    736 
    737 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetObjectFast,
    738                           art_portable_sget_object.fast,
    739                           kAttrReadOnly | kAttrNoThrow,
    740                           _JTYPE(kJavaObjectTy, kField),
    741                           _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy))
    742 
    743 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetBooleanFast,
    744                           art_portable_sget_boolean.fast,
    745                           kAttrReadOnly | kAttrNoThrow,
    746                           _JTYPE(kInt1Ty, kField),
    747                           _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy))
    748 
    749 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetByteFast,
    750                           art_portable_sget_byte.fast,
    751                           kAttrReadOnly | kAttrNoThrow,
    752                           _JTYPE(kInt8Ty, kField),
    753                           _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy))
    754 
    755 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetCharFast,
    756                           art_portable_sget_char.fast,
    757                           kAttrReadOnly | kAttrNoThrow,
    758                           _JTYPE(kInt16Ty, kField),
    759                           _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy))
    760 
    761 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetShortFast,
    762                           art_portable_sget_short.fast,
    763                           kAttrReadOnly | kAttrNoThrow,
    764                           _JTYPE(kInt16Ty, kField),
    765                           _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy))
    766 
    767 // void art_portable_sput_[type](uint32_t field_idx,
    768 //                           Method* referrer,
    769 //                           [type] new_value)
    770 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPut,
    771                           art_portable_sput,
    772                           kAttrNone,
    773                           kVoidTy,
    774                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt32Ty, kField)))
    775 
    776 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutWide,
    777                           art_portable_sput_wide,
    778                           kAttrNone,
    779                           kVoidTy,
    780                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt64Ty, kField)))
    781 
    782 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutObject,
    783                           art_portable_sput_object,
    784                           kAttrNone,
    785                           kVoidTy,
    786                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kJavaObjectTy, kField)))
    787 
    788 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutBoolean,
    789                           art_portable_sput_boolean,
    790                           kAttrNone,
    791                           kVoidTy,
    792                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt1Ty, kField)))
    793 
    794 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutByte,
    795                           art_portable_sput_byte,
    796                           kAttrNone,
    797                           kVoidTy,
    798                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt8Ty, kField)))
    799 
    800 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutChar,
    801                           art_portable_sput_char,
    802                           kAttrNone,
    803                           kVoidTy,
    804                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt16Ty, kField)))
    805 
    806 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutShort,
    807                           art_portable_sput_short,
    808                           kAttrNone,
    809                           kVoidTy,
    810                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt16Ty, kField)))
    811 
    812 // void art_portable_sput_[type].fast(JavaObject* ssb,
    813 //                                int field_offset,
    814 //                                bool is_volatile,
    815 //                                [type] new_value)
    816 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutFast,
    817                           art_portable_sput.fast,
    818                           kAttrNoThrow,
    819                           kVoidTy,
    820                           _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt32Ty, kField)))
    821 
    822 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutWideFast,
    823                           art_portable_sput_wide.fast,
    824                           kAttrNoThrow,
    825                           kVoidTy,
    826                           _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt64Ty, kField)))
    827 
    828 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutObjectFast,
    829                           art_portable_sput_object.fast,
    830                           kAttrNoThrow,
    831                           kVoidTy,
    832                           _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kJavaObjectTy, kField)))
    833 
    834 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutBooleanFast,
    835                           art_portable_sput_boolean.fast,
    836                           kAttrNoThrow,
    837                           kVoidTy,
    838                           _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt1Ty, kField)))
    839 
    840 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutByteFast,
    841                           art_portable_sput_byte.fast,
    842                           kAttrNoThrow,
    843                           kVoidTy,
    844                           _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt8Ty, kField)))
    845 
    846 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutCharFast,
    847                           art_portable_sput_char.fast,
    848                           kAttrNoThrow,
    849                           kVoidTy,
    850                           _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt16Ty, kField)))
    851 
    852 _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutShortFast,
    853                           art_portable_sput_short.fast,
    854                           kAttrNoThrow,
    855                           kVoidTy,
    856                           _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt16Ty, kField)))
    857 
    858 // JavaObject* art_portable_load_declaring_class_ssb(Method* method)
    859 // Load the static storage base of the class that given method resides
    860 _EVAL_DEF_INTRINSICS_FUNC(LoadDeclaringClassSSB,
    861                           art_portable_load_declaring_class_ssb,
    862                           kAttrReadOnly | kAttrNoThrow,
    863                           kJavaObjectTy,
    864                           _EXPAND_ARG1(kJavaMethodTy))
    865 
    866 // JavaObject* art_portable_load_class_ssb_from_dex_cache(uint32_t type_idx)
    867 _EVAL_DEF_INTRINSICS_FUNC(LoadClassSSBFromDexCache,
    868                           art_portable_load_class_ssb_from_dex_cache,
    869                           kAttrReadOnly | kAttrNoThrow,
    870                           kJavaObjectTy,
    871                           _EXPAND_ARG1(kInt32ConstantTy))
    872 
    873 // JavaObject* art_portable_init_and_load_class_ssb(uint32_t type_idx,
    874 //                                              Method* referrer,
    875 //                                              Thread* thread)
    876 _EVAL_DEF_INTRINSICS_FUNC(InitializeAndLoadClassSSB,
    877                           art_portable_init_and_load_class_ssb,
    878                           kAttrNone,
    879                           kJavaObjectTy,
    880                           _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy))
    881 
    882 //----------------------------------------------------------------------------
    883 // High-level Array get/put
    884 //
    885 // Similar to art_portable_aget/aput_xxx, but checks not yet performed.
    886 // OptFlags contain info describing whether frontend has determined that
    887 // null check and/or array bounds check may be skipped.
    888 //
    889 // [type] void art_portable_hl_aget_[type](int optFlags, JavaObject* array, uint32_t index)
    890 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGet,
    891                           art_portable_hl_aget,
    892                           kAttrReadOnly | kAttrNoThrow,
    893                           kInt32Ty,
    894                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    895 
    896 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetFloat,
    897                           art_portable_hl_aget_float,
    898                           kAttrReadOnly | kAttrNoThrow,
    899                           kFloatTy,
    900                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    901 
    902 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetWide,
    903                           art_portable_hl_aget_wide,
    904                           kAttrReadOnly | kAttrNoThrow,
    905                           kInt64Ty,
    906                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    907 
    908 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetDouble,
    909                           art_portable_hl_aget_double,
    910                           kAttrReadOnly | kAttrNoThrow,
    911                           kDoubleTy,
    912                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    913 
    914 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetObject,
    915                           art_portable_hl_aget_object,
    916                           kAttrReadOnly | kAttrNoThrow,
    917                           kJavaObjectTy,
    918                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    919 
    920 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetBoolean,
    921                           art_portable_hl_aget_boolean,
    922                           kAttrReadOnly | kAttrNoThrow,
    923                           kInt32Ty,
    924                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    925 
    926 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetByte,
    927                           art_portable_hl_aget_byte,
    928                           kAttrReadOnly | kAttrNoThrow,
    929                           kInt32Ty,
    930                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    931 
    932 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetChar,
    933                           art_portable_hl_aget_char,
    934                           kAttrReadOnly | kAttrNoThrow,
    935                           kInt32Ty,
    936                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    937 
    938 _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetShort,
    939                           art_portable_hl_aget_short,
    940                           kAttrReadOnly | kAttrNoThrow,
    941                           kInt32Ty,
    942                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
    943 
    944 // void art_portable_aput_[type](int optFlags, [type] value, JavaObject* array, uint32_t index)
    945 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPut,
    946                           art_portable_hl_aput,
    947                           kAttrNoThrow,
    948                           kVoidTy,
    949                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
    950 
    951 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutFloat,
    952                           art_portable_hl_aput_float,
    953                           kAttrNoThrow,
    954                           kVoidTy,
    955                           _EXPAND_ARG4(kInt32Ty, kFloatTy, kJavaObjectTy, kInt32Ty))
    956 
    957 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutWide,
    958                           art_portable_hl_aput_wide,
    959                           kAttrNoThrow,
    960                           kVoidTy,
    961                           _EXPAND_ARG4(kInt32Ty, kInt64Ty, kJavaObjectTy, kInt32Ty))
    962 
    963 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutDouble,
    964                           art_portable_hl_aput_double,
    965                           kAttrNoThrow,
    966                           kVoidTy,
    967                           _EXPAND_ARG4(kInt32Ty, kDoubleTy, kJavaObjectTy, kInt32Ty))
    968 
    969 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutObject,
    970                           art_portable_hl_aput_object,
    971                           kAttrNoThrow,
    972                           kVoidTy,
    973                           _EXPAND_ARG4(kInt32Ty, kJavaObjectTy, kJavaObjectTy, kInt32Ty))
    974 
    975 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutBoolean,
    976                           art_portable_hl_aput_boolean,
    977                           kAttrNoThrow,
    978                           kVoidTy,
    979                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
    980 
    981 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutByte,
    982                           art_portable_hl_aput_byte,
    983                           kAttrNoThrow,
    984                           kVoidTy,
    985                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
    986 
    987 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutChar,
    988                           art_portable_hl_aput_char,
    989                           kAttrNoThrow,
    990                           kVoidTy,
    991                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
    992 
    993 _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutShort,
    994                           art_portable_hl_aput_short,
    995                           kAttrNoThrow,
    996                           kVoidTy,
    997                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
    998 
    999 //----------------------------------------------------------------------------
   1000 // High-level Instance get/put
   1001 //
   1002 // Similar to art_portable_iget/iput_xxx, but checks not yet performed.
   1003 // OptFlags contain info describing whether frontend has determined that
   1004 // null check may be skipped.
   1005 //
   1006 // [type] void art_portable_hl_iget_[type](int optFlags, JavaObject* obj, uint32_t field_idx)
   1007 _EVAL_DEF_INTRINSICS_FUNC(HLIGet,
   1008                           art_portable_hl_iget,
   1009                           kAttrReadOnly | kAttrNoThrow,
   1010                           kInt32Ty,
   1011                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1012 
   1013 _EVAL_DEF_INTRINSICS_FUNC(HLIGetFloat,
   1014                           art_portable_hl_iget_float,
   1015                           kAttrReadOnly | kAttrNoThrow,
   1016                           kFloatTy,
   1017                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1018 
   1019 _EVAL_DEF_INTRINSICS_FUNC(HLIGetWide,
   1020                           art_portable_hl_iget_wide,
   1021                           kAttrReadOnly | kAttrNoThrow,
   1022                           kInt64Ty,
   1023                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1024 
   1025 _EVAL_DEF_INTRINSICS_FUNC(HLIGetDouble,
   1026                           art_portable_hl_iget_double,
   1027                           kAttrReadOnly | kAttrNoThrow,
   1028                           kDoubleTy,
   1029                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1030 
   1031 _EVAL_DEF_INTRINSICS_FUNC(HLIGetObject,
   1032                           art_portable_hl_iget_object,
   1033                           kAttrReadOnly | kAttrNoThrow,
   1034                           kJavaObjectTy,
   1035                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1036 
   1037 _EVAL_DEF_INTRINSICS_FUNC(HLIGetBoolean,
   1038                           art_portable_hl_iget_boolean,
   1039                           kAttrReadOnly | kAttrNoThrow,
   1040                           kInt32Ty,
   1041                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1042 
   1043 _EVAL_DEF_INTRINSICS_FUNC(HLIGetByte,
   1044                           art_portable_hl_iget_byte,
   1045                           kAttrReadOnly | kAttrNoThrow,
   1046                           kInt32Ty,
   1047                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1048 
   1049 _EVAL_DEF_INTRINSICS_FUNC(HLIGetChar,
   1050                           art_portable_hl_iget_char,
   1051                           kAttrReadOnly | kAttrNoThrow,
   1052                           kInt32Ty,
   1053                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1054 
   1055 _EVAL_DEF_INTRINSICS_FUNC(HLIGetShort,
   1056                           art_portable_hl_iget_short,
   1057                           kAttrReadOnly | kAttrNoThrow,
   1058                           kInt32Ty,
   1059                           _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty))
   1060 
   1061 // void art_portable_iput_[type](int optFlags, [type] value, JavaObject* obj, uint32_t field_idx)
   1062 _EVAL_DEF_INTRINSICS_FUNC(HLIPut,
   1063                           art_portable_hl_iput,
   1064                           kAttrNoThrow,
   1065                           kVoidTy,
   1066                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
   1067 
   1068 _EVAL_DEF_INTRINSICS_FUNC(HLIPutFloat,
   1069                           art_portable_hl_iput_float,
   1070                           kAttrNoThrow,
   1071                           kVoidTy,
   1072                           _EXPAND_ARG4(kInt32Ty, kFloatTy, kJavaObjectTy, kInt32Ty))
   1073 
   1074 _EVAL_DEF_INTRINSICS_FUNC(HLIPutWide,
   1075                           art_portable_hl_iput_wide,
   1076                           kAttrNoThrow,
   1077                           kVoidTy,
   1078                           _EXPAND_ARG4(kInt32Ty, kInt64Ty, kJavaObjectTy, kInt32Ty))
   1079 
   1080 _EVAL_DEF_INTRINSICS_FUNC(HLIPutDouble,
   1081                           art_portable_hl_iput_double,
   1082                           kAttrNoThrow,
   1083                           kVoidTy,
   1084                           _EXPAND_ARG4(kInt32Ty, kDoubleTy, kJavaObjectTy, kInt32Ty))
   1085 
   1086 _EVAL_DEF_INTRINSICS_FUNC(HLIPutObject,
   1087                           art_portable_hl_iput_object,
   1088                           kAttrNoThrow,
   1089                           kVoidTy,
   1090                           _EXPAND_ARG4(kInt32Ty, kJavaObjectTy, kJavaObjectTy, kInt32Ty))
   1091 
   1092 _EVAL_DEF_INTRINSICS_FUNC(HLIPutBoolean,
   1093                           art_portable_hl_iput_boolean,
   1094                           kAttrNoThrow,
   1095                           kVoidTy,
   1096                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
   1097 
   1098 _EVAL_DEF_INTRINSICS_FUNC(HLIPutByte,
   1099                           art_portable_hl_iput_byte,
   1100                           kAttrNoThrow,
   1101                           kVoidTy,
   1102                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
   1103 
   1104 _EVAL_DEF_INTRINSICS_FUNC(HLIPutChar,
   1105                           art_portable_hl_iput_char,
   1106                           kAttrNoThrow,
   1107                           kVoidTy,
   1108                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
   1109 
   1110 _EVAL_DEF_INTRINSICS_FUNC(HLIPutShort,
   1111                           art_portable_hl_iput_short,
   1112                           kAttrNoThrow,
   1113                           kVoidTy,
   1114                           _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty))
   1115 
   1116 //----------------------------------------------------------------------------
   1117 // High-level Invokes (fast-path determination not yet performed)
   1118 //
   1119 // NOTE: We expect these intrinsics to be temporary.  Once calling conventions are
   1120 //       fully merged, the unified front end will lower down to the
   1121 //       InvokeRetxxx() intrinsics in the next section and these will be
   1122 //       removed.
   1123 //
   1124 // arg0: InvokeType [ignored if FilledNewArray]
   1125 // arg1: method_idx [ignored if FilledNewArray]
   1126 // arg2: optimization_flags (primary to note whether null checking is needed)
   1127 // [arg3..argN]: actual arguments
   1128 //----------------------------------------------------------------------------
   1129 // INVOKE method returns void
   1130 _EVAL_DEF_INTRINSICS_FUNC(HLInvokeVoid,
   1131                           art_portable_hl_invoke.void,
   1132                           kAttrNone,
   1133                           kVoidTy,
   1134                           _EXPAND_ARG1(kVarArgTy))
   1135 
   1136 // INVOKE method returns object
   1137 _EVAL_DEF_INTRINSICS_FUNC(HLInvokeObj,
   1138                           art_portable_hl_invoke.obj,
   1139                           kAttrNone,
   1140                           kJavaObjectTy,
   1141                           _EXPAND_ARG1(kVarArgTy))
   1142 
   1143 // INVOKE method returns int
   1144 _EVAL_DEF_INTRINSICS_FUNC(HLInvokeInt,
   1145                           art_portable_hl_invoke.i32,
   1146                           kAttrNone,
   1147                           kInt32Ty,
   1148                           _EXPAND_ARG1(kVarArgTy))
   1149 
   1150 // INVOKE method returns float
   1151 _EVAL_DEF_INTRINSICS_FUNC(HLInvokeFloat,
   1152                           art_portable_hl_invoke.f32,
   1153                           kAttrNone,
   1154                           kFloatTy,
   1155                           _EXPAND_ARG1(kVarArgTy))
   1156 
   1157 // INVOKE method returns long
   1158 _EVAL_DEF_INTRINSICS_FUNC(HLInvokeLong,
   1159                           art_portable_hl_invoke.i64,
   1160                           kAttrNone,
   1161                           kInt64Ty,
   1162                           _EXPAND_ARG1(kVarArgTy))
   1163 
   1164 // INVOKE method returns double
   1165 _EVAL_DEF_INTRINSICS_FUNC(HLInvokeDouble,
   1166                           art_portable_hl_invoke.f64,
   1167                           kAttrNone,
   1168                           kDoubleTy,
   1169                           _EXPAND_ARG1(kVarArgTy))
   1170 
   1171 // FILLED_NEW_ARRAY returns object
   1172 _EVAL_DEF_INTRINSICS_FUNC(HLFilledNewArray,
   1173                           art_portable_hl_filled_new_array,
   1174                           kAttrNone,
   1175                           kJavaObjectTy,
   1176                           _EXPAND_ARG1(kVarArgTy))
   1177 
   1178 //----------------------------------------------------------------------------
   1179 // Invoke
   1180 //----------------------------------------------------------------------------
   1181 
   1182 // Method* art_portable_find_static_method_with_access_check(uint32_t method_idx,
   1183 //                                                       JavaObject* this,
   1184 //                                                       Method* referrer,
   1185 //                                                       Thread* thread)
   1186 _EVAL_DEF_INTRINSICS_FUNC(FindStaticMethodWithAccessCheck,
   1187                           art_portable_find_static_method_with_access_check,
   1188                           kAttrNone,
   1189                           kJavaMethodTy,
   1190                           _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy))
   1191 
   1192 // Method* art_portable_find_direct_method_with_access_check(uint32_t method_idx,
   1193 //                                                       JavaObject* this,
   1194 //                                                       Method* referrer,
   1195 //                                                       Thread* thread)
   1196 _EVAL_DEF_INTRINSICS_FUNC(FindDirectMethodWithAccessCheck,
   1197                           art_portable_find_direct_method_with_access_check,
   1198                           kAttrNone,
   1199                           kJavaMethodTy,
   1200                           _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy))
   1201 
   1202 // Method* art_portable_find_virtual_method_with_access_check(uint32_t method_idx,
   1203 //                                                        JavaObject* this,
   1204 //                                                        Method* referrer,
   1205 //                                                        Thread* thread)
   1206 _EVAL_DEF_INTRINSICS_FUNC(FindVirtualMethodWithAccessCheck,
   1207                           art_portable_find_virtual_method_with_access_check,
   1208                           kAttrNone,
   1209                           kJavaMethodTy,
   1210                           _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy))
   1211 
   1212 // Method* art_portable_find_super_method_with_access_check(uint32_t method_idx,
   1213 //                                                      JavaObject* this,
   1214 //                                                      Method* referrer,
   1215 //                                                      Thread* thread)
   1216 _EVAL_DEF_INTRINSICS_FUNC(FindSuperMethodWithAccessCheck,
   1217                           art_portable_find_super_method_with_access_check,
   1218                           kAttrNone,
   1219                           kJavaMethodTy,
   1220                           _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy))
   1221 
   1222 // Method* art_portable_find_interface_method_with_access_check(uint32_t method_idx,
   1223 //                                                          JavaObject* this,
   1224 //                                                          Method* referrer,
   1225 //                                                          Thread* thread)
   1226 _EVAL_DEF_INTRINSICS_FUNC(FindInterfaceMethodWithAccessCheck,
   1227                           art_portable_find_interface_method_with_access_check,
   1228                           kAttrNone,
   1229                           kJavaMethodTy,
   1230                           _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy))
   1231 
   1232 // Method* art_portable_get_sd_callee_method_obj_addr(uint32_t method_idx)
   1233 _EVAL_DEF_INTRINSICS_FUNC(GetSDCalleeMethodObjAddrFast,
   1234                           art_portable_get_sd_callee_method_obj_addr_fast,
   1235                           kAttrReadOnly | kAttrNoThrow,
   1236                           kJavaMethodTy,
   1237                           _EXPAND_ARG1(kInt32ConstantTy))
   1238 
   1239 // Method* art_portable_get_virtual_callee_method_obj_addr(uint32_t vtable_idx,
   1240 //                                                     JavaObject* this)
   1241 _EVAL_DEF_INTRINSICS_FUNC(GetVirtualCalleeMethodObjAddrFast,
   1242                           art_portable_get_virtual_callee_method_obj_addr_fast,
   1243                           kAttrReadOnly | kAttrNoThrow,
   1244                           kJavaMethodTy,
   1245                           _EXPAND_ARG2(kInt32ConstantTy, kJavaObjectTy))
   1246 
   1247 // Method* art_portable_get_interface_callee_method_obj_addr(uint32_t method_idx,
   1248 //                                                       JavaObject* this,
   1249 //                                                       Method* referrer,
   1250 //                                                       Thread* thread)
   1251 _EVAL_DEF_INTRINSICS_FUNC(GetInterfaceCalleeMethodObjAddrFast,
   1252                           art_portable_get_interface_callee_method_obj_addr_fast,
   1253                           kAttrNone,
   1254                           kJavaMethodTy,
   1255                           _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy))
   1256 
   1257 // [type] art_portable_invoke.[type](Method* callee, ...)
   1258 // INVOKE method returns void
   1259 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetVoid,
   1260                           art_portable_invoke.void,
   1261                           kAttrNone,
   1262                           kVoidTy,
   1263                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1264 
   1265 // INVOKE method returns the value of type boolean
   1266 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetBoolean,
   1267                           art_portable_invoke.bool,
   1268                           kAttrNone,
   1269                           kInt1Ty,
   1270                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1271 
   1272 // INVOKE method returns the value of type byte
   1273 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetByte,
   1274                           art_portable_invoke.byte,
   1275                           kAttrNone,
   1276                           kInt8Ty,
   1277                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1278 
   1279 // INVOKE method returns the value of type char
   1280 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetChar,
   1281                           art_portable_invoke.char,
   1282                           kAttrNone,
   1283                           kInt16Ty,
   1284                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1285 
   1286 // INVOKE method returns the value of type short
   1287 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetShort,
   1288                           art_portable_invoke.short,
   1289                           kAttrNone,
   1290                           kInt16Ty,
   1291                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1292 
   1293 // INVOKE method returns the value of type int
   1294 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetInt,
   1295                           art_portable_invoke.int,
   1296                           kAttrNone,
   1297                           kInt32Ty,
   1298                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1299 
   1300 // INVOKE method returns the value of type long
   1301 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetLong,
   1302                           art_portable_invoke.long,
   1303                           kAttrNone,
   1304                           kInt64Ty,
   1305                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1306 
   1307 // INVOKE method returns the value of type float
   1308 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetFloat,
   1309                           art_portable_invoke.float,
   1310                           kAttrNone,
   1311                           kFloatTy,
   1312                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1313 
   1314 // INVOKE method returns the value of type double
   1315 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetDouble,
   1316                           art_portable_invoke.double,
   1317                           kAttrNone,
   1318                           kDoubleTy,
   1319                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1320 
   1321 // INVOKE method returns the value of type "object"
   1322 _EVAL_DEF_INTRINSICS_FUNC(InvokeRetObject,
   1323                           art_portable_invoke.object,
   1324                           kAttrNone,
   1325                           kJavaObjectTy,
   1326                           _EXPAND_ARG2(kJavaMethodTy, kVarArgTy))
   1327 
   1328 //----------------------------------------------------------------------------
   1329 // Math
   1330 //----------------------------------------------------------------------------
   1331 
   1332 // int art_portable_{div,rem}_int(int a, int b)
   1333 _EVAL_DEF_INTRINSICS_FUNC(DivInt,
   1334                           art_portable_div_int,
   1335                           kAttrReadNone | kAttrNoThrow,
   1336                           kInt32Ty,
   1337                           _EXPAND_ARG2(kInt32Ty, kInt32Ty))
   1338 
   1339 _EVAL_DEF_INTRINSICS_FUNC(RemInt,
   1340                           art_portable_rem_int,
   1341                           kAttrReadNone | kAttrNoThrow,
   1342                           kInt32Ty,
   1343                           _EXPAND_ARG2(kInt32Ty, kInt32Ty))
   1344 
   1345 // long art_portable_{div,rem}_long(long a, long b)
   1346 _EVAL_DEF_INTRINSICS_FUNC(DivLong,
   1347                           art_portable_div_long,
   1348                           kAttrReadNone | kAttrNoThrow,
   1349                           kInt64Ty,
   1350                           _EXPAND_ARG2(kInt64Ty, kInt64Ty))
   1351 
   1352 _EVAL_DEF_INTRINSICS_FUNC(RemLong,
   1353                           art_portable_rem_long,
   1354                           kAttrReadNone | kAttrNoThrow,
   1355                           kInt64Ty,
   1356                           _EXPAND_ARG2(kInt64Ty, kInt64Ty))
   1357 
   1358 // int64_t art_portable_d2l(double f)
   1359 _EVAL_DEF_INTRINSICS_FUNC(D2L,
   1360                           art_portable_d2l,
   1361                           kAttrReadNone | kAttrNoThrow,
   1362                           kInt64Ty,
   1363                           _EXPAND_ARG1(kDoubleTy))
   1364 
   1365 // int32_t art_portable_d2l(double f)
   1366 _EVAL_DEF_INTRINSICS_FUNC(D2I,
   1367                           art_portable_d2i,
   1368                           kAttrReadNone | kAttrNoThrow,
   1369                           kInt32Ty,
   1370                           _EXPAND_ARG1(kDoubleTy))
   1371 
   1372 // int64_t art_portable_f2l(float f)
   1373 _EVAL_DEF_INTRINSICS_FUNC(F2L,
   1374                           art_portable_f2l,
   1375                           kAttrReadNone | kAttrNoThrow,
   1376                           kInt64Ty,
   1377                           _EXPAND_ARG1(kFloatTy))
   1378 
   1379 // int32_t art_portable_f2i(float f)
   1380 _EVAL_DEF_INTRINSICS_FUNC(F2I,
   1381                           art_portable_f2i,
   1382                           kAttrReadNone | kAttrNoThrow,
   1383                           kInt32Ty,
   1384                           _EXPAND_ARG1(kFloatTy))
   1385 
   1386 //----------------------------------------------------------------------------
   1387 // sput intrinsics to assist MIR to Greenland_ir conversion.
   1388 // "HL" versions - will be deprecated when fast/slow path handling done
   1389 // in the common frontend.
   1390 //----------------------------------------------------------------------------
   1391 
   1392 // void sput_hl(int field_idx, int val)
   1393 _EVAL_DEF_INTRINSICS_FUNC(HLSput,
   1394                           art_portable_hl_sput,
   1395                           kAttrReadOnly | kAttrNoThrow,
   1396                           kVoidTy,
   1397                           _EXPAND_ARG2(kInt32Ty, kInt32Ty))
   1398 
   1399 // void sput_hl_object(int field_idx, object* val)
   1400 _EVAL_DEF_INTRINSICS_FUNC(HLSputObject,
   1401                           art_portable_hl_sput_object,
   1402                           kAttrReadOnly | kAttrNoThrow,
   1403                           kVoidTy,
   1404                           _EXPAND_ARG2(kInt32Ty, kJavaObjectTy))
   1405 
   1406 // void sput_hl_boolean(int field_idx, kInt1Ty)
   1407 _EVAL_DEF_INTRINSICS_FUNC(HLSputBoolean,
   1408                           art_portable_hl_sput_boolean,
   1409                           kAttrReadOnly | kAttrNoThrow,
   1410                           kVoidTy,
   1411                           _EXPAND_ARG2(kInt32Ty, kInt32Ty))
   1412 
   1413 // void sput_hl_byte(int field_idx, int val)
   1414 _EVAL_DEF_INTRINSICS_FUNC(HLSputByte,
   1415                           art_portable_hl_sput_byte,
   1416                           kAttrReadOnly | kAttrNoThrow,
   1417                           kVoidTy,
   1418                           _EXPAND_ARG2(kInt32Ty, kInt32Ty))
   1419 
   1420 // void sput_hl_char(int field_idx, kInt16Ty val)
   1421 _EVAL_DEF_INTRINSICS_FUNC(HLSputChar,
   1422                           art_portable_hl_sput_char,
   1423                           kAttrReadOnly | kAttrNoThrow,
   1424                           kVoidTy,
   1425                           _EXPAND_ARG2(kInt32Ty, kInt32Ty))
   1426 
   1427 // void sput_hl_short(int field_idx, int val)
   1428 _EVAL_DEF_INTRINSICS_FUNC(HLSputShort,
   1429                           art_portable_hl_sput_short,
   1430                           kAttrReadOnly | kAttrNoThrow,
   1431                           kVoidTy,
   1432                           _EXPAND_ARG2(kInt32Ty, kInt32Ty))
   1433 
   1434 // void sput_hl_wide(int field_idx, long val)
   1435 _EVAL_DEF_INTRINSICS_FUNC(HLSputWide,
   1436                           art_portable_hl_sput_wide,
   1437                           kAttrReadOnly | kAttrNoThrow,
   1438                           kVoidTy,
   1439                           _EXPAND_ARG2(kInt32Ty, kInt64Ty))
   1440 
   1441 // void sput_hl_double(int field_idx, double val)
   1442 _EVAL_DEF_INTRINSICS_FUNC(HLSputDouble,
   1443                           art_portable_hl_sput_double,
   1444                           kAttrReadOnly | kAttrNoThrow,
   1445                           kVoidTy,
   1446                           _EXPAND_ARG2(kInt32Ty, kDoubleTy))
   1447 
   1448 // void sput_hl_float(int field_idx, float val)
   1449 _EVAL_DEF_INTRINSICS_FUNC(HLSputFloat,
   1450                           art_portable_hl_sput_float,
   1451                           kAttrReadOnly | kAttrNoThrow,
   1452                           kVoidTy,
   1453                           _EXPAND_ARG2(kInt32Ty, kFloatTy))
   1454 
   1455 //----------------------------------------------------------------------------
   1456 // sget intrinsics to assist MIR to Greenland_ir conversion.
   1457 // "HL" versions - will be deprecated when fast/slow path handling done
   1458 // in the common frontend.
   1459 //----------------------------------------------------------------------------
   1460 
   1461 // int sget_hl(int field_idx)
   1462 _EVAL_DEF_INTRINSICS_FUNC(HLSget,
   1463                           art_portable_hl_sget,
   1464                           kAttrReadOnly | kAttrNoThrow,
   1465                           kInt32Ty,
   1466                           _EXPAND_ARG1(kInt32Ty))
   1467 
   1468 // object* sget_hl_object(int field_idx)
   1469 _EVAL_DEF_INTRINSICS_FUNC(HLSgetObject,
   1470                           art_portable_hl_sget_object,
   1471                           kAttrReadOnly | kAttrNoThrow,
   1472                           kJavaObjectTy,
   1473                           _EXPAND_ARG1(kInt32Ty))
   1474 
   1475 // boolean sget_hl_boolean(int field_idx)
   1476 _EVAL_DEF_INTRINSICS_FUNC(HLSgetBoolean,
   1477                           art_portable_hl_sget_boolean,
   1478                           kAttrReadOnly | kAttrNoThrow,
   1479                           kInt32Ty,
   1480                           _EXPAND_ARG1(kInt32Ty))
   1481 
   1482 // byte sget_hl_byte(int field_idx)
   1483 _EVAL_DEF_INTRINSICS_FUNC(HLSgetByte,
   1484                           art_portable_hl_sget_byte,
   1485                           kAttrReadOnly | kAttrNoThrow,
   1486                           kInt32Ty,
   1487                           _EXPAND_ARG1(kInt32Ty))
   1488 
   1489 // char sget_hl_char(int field_idx)
   1490 _EVAL_DEF_INTRINSICS_FUNC(HLSgetChar,
   1491                           art_portable_hl_sget_char,
   1492                           kAttrReadOnly | kAttrNoThrow,
   1493                           kInt32Ty,
   1494                           _EXPAND_ARG1(kInt32Ty))
   1495 
   1496 // char sget_hl_short(int field_idx)
   1497 _EVAL_DEF_INTRINSICS_FUNC(HLSgetShort,
   1498                           art_portable_hl_sget_short,
   1499                           kAttrReadOnly | kAttrNoThrow,
   1500                           kInt32Ty,
   1501                           _EXPAND_ARG1(kInt32Ty))
   1502 
   1503 // char sget_hl_wide(int field_idx)
   1504 _EVAL_DEF_INTRINSICS_FUNC(HLSgetWide,
   1505                           art_portable_hl_sget_wide,
   1506                           kAttrReadOnly | kAttrNoThrow,
   1507                           kInt64Ty,
   1508                           _EXPAND_ARG1(kInt32Ty))
   1509 
   1510 // char sget_hl_double(int field_idx)
   1511 _EVAL_DEF_INTRINSICS_FUNC(HLSgetDouble,
   1512                           art_portable_hl_sget_double,
   1513                           kAttrReadOnly | kAttrNoThrow,
   1514                           kDoubleTy,
   1515                           _EXPAND_ARG1(kInt32Ty))
   1516 
   1517 // char sget_hl_float(int field_idx)
   1518 _EVAL_DEF_INTRINSICS_FUNC(HLSgetFloat,
   1519                           art_portable_hl_sget_float,
   1520                           kAttrReadOnly | kAttrNoThrow,
   1521                           kFloatTy,
   1522                           _EXPAND_ARG1(kInt32Ty))
   1523 //----------------------------------------------------------------------------
   1524 // Monitor enter/exit
   1525 //----------------------------------------------------------------------------
   1526 // uint32_t art_portable_monitor_enter(int optFlags, JavaObject* obj)
   1527 _EVAL_DEF_INTRINSICS_FUNC(MonitorEnter,
   1528                           art_portable_monitor_enter,
   1529                           kAttrReadOnly | kAttrNoThrow,
   1530                           kVoidTy,
   1531                           _EXPAND_ARG2(kInt32Ty, kJavaObjectTy))
   1532 
   1533 // uint32_t art_portable_monitor_exit(int optFlags, JavaObject* obj)
   1534 _EVAL_DEF_INTRINSICS_FUNC(MonitorExit,
   1535                           art_portable_monitor_exit,
   1536                           kAttrReadOnly | kAttrNoThrow,
   1537                           kVoidTy,
   1538                           _EXPAND_ARG2(kInt32Ty, kJavaObjectTy))
   1539 
   1540 //----------------------------------------------------------------------------
   1541 // Shadow Frame
   1542 //----------------------------------------------------------------------------
   1543 
   1544 // void art_portable_alloca_shadow_frame(int num_entry)
   1545 _EVAL_DEF_INTRINSICS_FUNC(AllocaShadowFrame,
   1546                           art_portable_alloca_shadow_frame,
   1547                           kAttrNoThrow,
   1548                           kVoidTy,
   1549                           _EXPAND_ARG1(kInt32ConstantTy))
   1550 
   1551 // void art_portable_set_vreg(int entry_idx, ...)
   1552 _EVAL_DEF_INTRINSICS_FUNC(SetVReg,
   1553                           art_portable_set_vreg,
   1554                           kAttrNoThrow,
   1555                           kVoidTy,
   1556                           _EXPAND_ARG2(kInt32ConstantTy, kVarArgTy))
   1557 
   1558 // void art_portable_pop_shadow_frame()
   1559 _EVAL_DEF_INTRINSICS_FUNC(PopShadowFrame,
   1560                           art_portable_pop_shadow_frame,
   1561                           kAttrNoThrow,
   1562                           kVoidTy,
   1563                           _EXPAND_ARG0())
   1564 
   1565 // void art_portable_update_dex_pc(uint32_t dex_pc)
   1566 _EVAL_DEF_INTRINSICS_FUNC(UpdateDexPC,
   1567                           art_portable_update_dex_pc,
   1568                           kAttrNoThrow,
   1569                           kVoidTy,
   1570                           _EXPAND_ARG1(kInt32ConstantTy))
   1571 
   1572 //----------------------------------------------------------------------------
   1573 // FP Comparison
   1574 //----------------------------------------------------------------------------
   1575 // int cmpl_float(float, float)
   1576 _EVAL_DEF_INTRINSICS_FUNC(CmplFloat,
   1577                           art_portable_cmpl_float,
   1578                           kAttrReadOnly | kAttrNoThrow,
   1579                           kInt32Ty,
   1580                           _EXPAND_ARG2(kFloatTy, kFloatTy))
   1581 
   1582 // int cmpg_float(float, float)
   1583 _EVAL_DEF_INTRINSICS_FUNC(CmpgFloat,
   1584                           art_portable_cmpg_float,
   1585                           kAttrReadOnly | kAttrNoThrow,
   1586                           kInt32Ty,
   1587                           _EXPAND_ARG2(kFloatTy, kFloatTy))
   1588 
   1589 // int cmpl_double(double, double)
   1590 _EVAL_DEF_INTRINSICS_FUNC(CmplDouble,
   1591                           art_portable_cmpl_double,
   1592                           kAttrReadOnly | kAttrNoThrow,
   1593                           kInt32Ty,
   1594                           _EXPAND_ARG2(kDoubleTy, kDoubleTy))
   1595 
   1596 // int cmpg_double(double, double)
   1597 _EVAL_DEF_INTRINSICS_FUNC(CmpgDouble,
   1598                           art_portable_cmpg_double,
   1599                           kAttrReadOnly | kAttrNoThrow,
   1600                           kInt32Ty,
   1601                           _EXPAND_ARG2(kDoubleTy, kDoubleTy))
   1602 
   1603 //----------------------------------------------------------------------------
   1604 // Long Comparison
   1605 //----------------------------------------------------------------------------
   1606 // int cmp_long(long, long)
   1607 _EVAL_DEF_INTRINSICS_FUNC(CmpLong,
   1608                           art_portable_cmp_long,
   1609                           kAttrReadOnly | kAttrNoThrow,
   1610                           kInt32Ty,
   1611                           _EXPAND_ARG2(kInt64Ty, kInt64Ty))
   1612 
   1613 //----------------------------------------------------------------------------
   1614 // Const intrinsics to assist MIR to Greenland_ir conversion.  Should not materialize
   1615 // For simplicity, all use integer input
   1616 //----------------------------------------------------------------------------
   1617 // int const_int(int)
   1618 _EVAL_DEF_INTRINSICS_FUNC(ConstInt,
   1619                           art_portable_const_int,
   1620                           kAttrReadOnly | kAttrNoThrow,
   1621                           kInt32Ty,
   1622                           _EXPAND_ARG1(kInt32Ty))
   1623 
   1624 // JavaObject* const_obj(int)
   1625 _EVAL_DEF_INTRINSICS_FUNC(ConstObj,
   1626                           art_portable_const_obj,
   1627                           kAttrReadOnly | kAttrNoThrow,
   1628                           kJavaObjectTy,
   1629                           _EXPAND_ARG1(kInt32Ty))
   1630 
   1631 // long const_long(long)
   1632 _EVAL_DEF_INTRINSICS_FUNC(ConstLong,
   1633                           art_portable_const_long,
   1634                           kAttrReadOnly | kAttrNoThrow,
   1635                           kInt64Ty,
   1636                           _EXPAND_ARG1(kInt64Ty))
   1637 
   1638 // float const_float(int)
   1639 _EVAL_DEF_INTRINSICS_FUNC(ConstFloat,
   1640                           art_portable_const_Float,
   1641                           kAttrReadOnly | kAttrNoThrow,
   1642                           kFloatTy,
   1643                           _EXPAND_ARG1(kInt32Ty))
   1644 
   1645 // double const_double(long)
   1646 _EVAL_DEF_INTRINSICS_FUNC(ConstDouble,
   1647                           art_portable_const_Double,
   1648                           kAttrReadOnly | kAttrNoThrow,
   1649                           kDoubleTy,
   1650                           _EXPAND_ARG1(kInt64Ty))
   1651 
   1652 
   1653 //----------------------------------------------------------------------------
   1654 // Copy intrinsics to assist MIR to Greenland_ir conversion.  Should not materialize
   1655 //----------------------------------------------------------------------------
   1656 
   1657 // void method_info(void)
   1658 _EVAL_DEF_INTRINSICS_FUNC(MethodInfo,
   1659                           art_portable_method_info,
   1660                           kAttrReadOnly | kAttrNoThrow,
   1661                           kVoidTy,
   1662                           _EXPAND_ARG0())
   1663 
   1664 // int copy_int(int)
   1665 _EVAL_DEF_INTRINSICS_FUNC(CopyInt,
   1666                           art_portable_copy_int,
   1667                           kAttrReadOnly | kAttrNoThrow,
   1668                           kInt32Ty,
   1669                           _EXPAND_ARG1(kInt32Ty))
   1670 
   1671 // JavaObject* copy_obj(obj)
   1672 _EVAL_DEF_INTRINSICS_FUNC(CopyObj,
   1673                           art_portable_copy_obj,
   1674                           kAttrReadOnly | kAttrNoThrow,
   1675                           kJavaObjectTy,
   1676                           _EXPAND_ARG1(kJavaObjectTy))
   1677 
   1678 // long copy_long(long)
   1679 _EVAL_DEF_INTRINSICS_FUNC(CopyLong,
   1680                           art_portable_copy_long,
   1681                           kAttrReadOnly | kAttrNoThrow,
   1682                           kInt64Ty,
   1683                           _EXPAND_ARG1(kInt64Ty))
   1684 
   1685 // float copy_float(float)
   1686 _EVAL_DEF_INTRINSICS_FUNC(CopyFloat,
   1687                           art_portable_copy_Float,
   1688                           kAttrReadOnly | kAttrNoThrow,
   1689                           kFloatTy,
   1690                           _EXPAND_ARG1(kFloatTy))
   1691 
   1692 // double copy_double(double)
   1693 _EVAL_DEF_INTRINSICS_FUNC(CopyDouble,
   1694                           art_portable_copy_Double,
   1695                           kAttrReadOnly | kAttrNoThrow,
   1696                           kDoubleTy,
   1697                           _EXPAND_ARG1(kDoubleTy))
   1698 
   1699 //----------------------------------------------------------------------------
   1700 // Shift intrinsics.  Shift semantics for Dalvik are a bit different than
   1701 // the llvm shift operators.  For 32-bit shifts, the shift count is constrained
   1702 // to the range of 0..31, while for 64-bit shifts we limit to 0..63.
   1703 // Further, the shift count for Long shifts in Dalvik is 32 bits, while
   1704 // llvm requires a 64-bit shift count. For GBC, we represent shifts as an
   1705 //  intrinsic to allow most efficient target-dependent lowering.
   1706 //----------------------------------------------------------------------------
   1707 // long shl_long(long,int)
   1708 _EVAL_DEF_INTRINSICS_FUNC(SHLLong,
   1709                           art_portable_shl_long,
   1710                           kAttrReadOnly | kAttrNoThrow,
   1711                           kInt64Ty,
   1712                           _EXPAND_ARG2(kInt64Ty,kInt32Ty))
   1713 // long shr_long(long,int)
   1714 _EVAL_DEF_INTRINSICS_FUNC(SHRLong,
   1715                           art_portable_shr_long,
   1716                           kAttrReadOnly | kAttrNoThrow,
   1717                           kInt64Ty,
   1718                           _EXPAND_ARG2(kInt64Ty,kInt32Ty))
   1719 // long ushr_long(long,int)
   1720 _EVAL_DEF_INTRINSICS_FUNC(USHRLong,
   1721                           art_portable_ushl_long,
   1722                           kAttrReadOnly | kAttrNoThrow,
   1723                           kInt64Ty,
   1724                           _EXPAND_ARG2(kInt64Ty,kInt32Ty))
   1725 // int shl_int(int,int)
   1726 _EVAL_DEF_INTRINSICS_FUNC(SHLInt,
   1727                           art_portable_shl_int,
   1728                           kAttrReadOnly | kAttrNoThrow,
   1729                           kInt32Ty,
   1730                           _EXPAND_ARG2(kInt32Ty,kInt32Ty))
   1731 // long shr_int(int,int)
   1732 _EVAL_DEF_INTRINSICS_FUNC(SHRInt,
   1733                           art_portable_shr_int,
   1734                           kAttrReadOnly | kAttrNoThrow,
   1735                           kInt32Ty,
   1736                           _EXPAND_ARG2(kInt32Ty,kInt32Ty))
   1737 // int ushr_long(int,int)
   1738 _EVAL_DEF_INTRINSICS_FUNC(USHRInt,
   1739                           art_portable_ushl_int,
   1740                           kAttrReadOnly | kAttrNoThrow,
   1741                           kInt32Ty,
   1742                           _EXPAND_ARG2(kInt32Ty,kInt32Ty))
   1743 //----------------------------------------------------------------------------
   1744 // Conversion instrinsics.  Note: these should eventually be removed.  We
   1745 // can express these directly in bitcode, but by using intrinsics the
   1746 // Quick compiler can be more efficient.  Some extra optimization infrastructure
   1747 // will have to be developed to undo the bitcode verbosity when these are
   1748 // done inline.
   1749 //----------------------------------------------------------------------------
   1750 // int int_to_byte(int)
   1751 _EVAL_DEF_INTRINSICS_FUNC(IntToByte,
   1752                           art_portable_int_to_byte,
   1753                           kAttrReadOnly | kAttrNoThrow,
   1754                           kInt32Ty,
   1755                           _EXPAND_ARG1(kInt32Ty))
   1756 
   1757 // int int_to_char(int)
   1758 _EVAL_DEF_INTRINSICS_FUNC(IntToChar,
   1759                           art_portable_int_to_char,
   1760                           kAttrReadOnly | kAttrNoThrow,
   1761                           kInt32Ty,
   1762                           _EXPAND_ARG1(kInt32Ty))
   1763 
   1764 // int int_to_short(int)
   1765 _EVAL_DEF_INTRINSICS_FUNC(IntToShort,
   1766                           art_portable_int_to_short,
   1767                           kAttrReadOnly | kAttrNoThrow,
   1768                           kInt32Ty,
   1769                           _EXPAND_ARG1(kInt32Ty))
   1770 
   1771 //----------------------------------------------------------------------------
   1772 // Memory barrier
   1773 //----------------------------------------------------------------------------
   1774 // void constructor_barrier()
   1775 _EVAL_DEF_INTRINSICS_FUNC(ConstructorBarrier,
   1776                           art_portable_constructor_barrier,
   1777                           kAttrReadOnly | kAttrNoThrow,
   1778                           kVoidTy,
   1779                           _EXPAND_ARG0())
   1780 
   1781 // Clean up all internal used macros
   1782 #undef _EXPAND_ARG0
   1783 #undef _EXPAND_ARG1
   1784 #undef _EXPAND_ARG2
   1785 #undef _EXPAND_ARG3
   1786 #undef _EXPAND_ARG4
   1787 #undef _EXPAND_ARG5
   1788 
   1789 #undef _JTYPE_OF_kInt1Ty_UNDER_kArray
   1790 #undef _JTYPE_OF_kInt8Ty_UNDER_kArray
   1791 #undef _JTYPE_OF_kInt16Ty_UNDER_kArray
   1792 #undef _JTYPE_OF_kInt32Ty_UNDER_kArray
   1793 #undef _JTYPE_OF_kInt64Ty_UNDER_kArray
   1794 #undef _JTYPE_OF_kJavaObjectTy_UNDER_kArray
   1795 
   1796 #undef _JTYPE_OF_kInt1Ty_UNDER_kField
   1797 #undef _JTYPE_OF_kInt8Ty_UNDER_kField
   1798 #undef _JTYPE_OF_kInt16Ty_UNDER_kField
   1799 #undef _JTYPE_OF_kInt32Ty_UNDER_kField
   1800 #undef _JTYPE_OF_kInt64Ty_UNDER_kField
   1801 #undef _JTYPE_OF_kJavaObjectTy_UNDER_kField
   1802 
   1803 #undef DEF_INTRINSICS_FUNC
   1804