1#!/bin/bash 2# 3# Copyright (C) 2015 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17echo ' 18.class multidimensional 19.super java/lang/Object 20' 21 22function onetype() { 23local typename=$1 24local stacksize=$2 25local defaultvalue=$3 26local descriptor=$4 27local defaultload=$5 28local loadstoreprefix=$6 29local returnprefix=${7:-$loadstoreprefix} 30echo " 31; Output from some versions of javac on: 32; public static $typename test_get${typename^}Array() { 33; $typename[][] array = null; 34; return array[1][1]; 35; } 36.method public static test_get${typename^}Array()$descriptor 37 .limit locals 1 38 .limit stack 2 39 40 aconst_null 41 astore_0 42 aload_0 43 iconst_1 44 aaload 45 iconst_1 46 ${loadstoreprefix}aload 47 ${returnprefix}return 48.end method 49 50; Output from some versions of javac on: 51; public static void test_set${typename^}Array() { 52; $typename[][] array = null; 53; array[1][1] = $defaultvalue; 54; } 55.method public static test_set${typename^}Array()V 56 .limit locals 1 57 .limit stack $((stacksize+2)) 58 59 aconst_null 60 astore_0 61 aload_0 62 iconst_1 63 aaload 64 iconst_1 65 $defaultload 66 ${loadstoreprefix}astore 67 return 68.end method 69" 70} 71 72onetype Object 1 null 'Ljava/lang/Object;' aconst_null a 73onetype boolean 1 false Z iconst_0 b i 74onetype byte 1 0 B iconst_0 b i 75onetype char 1 0 C iconst_0 c i 76onetype short 1 0 S iconst_0 s i 77onetype int 1 0 I iconst_0 i 78onetype long 2 0 J lconst_0 l 79onetype float 1 0 F fconst_0 f 80onetype double 2 0 D dconst_0 d 81