Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | */ |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 16 | |
| 17 | #include <stdio.h> |
| 18 | |
| 19 | #include "UniquePtr.h" |
| 20 | #include "class_linker.h" |
| 21 | #include "dex_verifier.h" |
| 22 | #include "object.h" |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 23 | #include "object_utils.h" |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 24 | #include "thread.h" |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 25 | #include "jni.h" |
| 26 | |
| 27 | namespace art { |
| 28 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 29 | #define IS_IN_REF_BITMAP(mh, ref_bitmap, reg) \ |
| 30 | ( ((reg) < mh.GetCodeItem()->registers_size_) && \ |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 31 | (( *((ref_bitmap) + (reg)/8) >> ((reg) % 8) ) & 0x01) ) |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 32 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 33 | #define CHECK_REGS_CONTAIN_REFS(...) \ |
| 34 | do { \ |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 35 | int t[] = {__VA_ARGS__}; \ |
| 36 | int t_size = sizeof(t) / sizeof(*t); \ |
| 37 | for (int i = 0; i < t_size; ++i) \ |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 38 | CHECK(IS_IN_REF_BITMAP(mh, ref_bitmap, t[i])) \ |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 39 | << "Error: Reg @ " << i << "-th argument is not in GC map"; \ |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 40 | } while(false) |
| 41 | |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 42 | struct ReferenceMap2Visitor : public Thread::StackVisitor { |
| 43 | ReferenceMap2Visitor() { |
| 44 | } |
| 45 | |
Elliott Hughes | 530fa00 | 2012-03-12 11:44:49 -0700 | [diff] [blame] | 46 | bool VisitFrame(const Frame& frame, uintptr_t pc) { |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 47 | Method* m = frame.GetMethod(); |
Brian Carlstrom | 40381fb | 2011-10-19 14:13:40 -0700 | [diff] [blame] | 48 | if (!m || m->IsNative()) { |
Elliott Hughes | 530fa00 | 2012-03-12 11:44:49 -0700 | [diff] [blame] | 49 | return true; |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 50 | } |
| 51 | LOG(INFO) << "At " << PrettyMethod(m, false); |
| 52 | |
Brian Carlstrom | e7d856b | 2012-01-11 18:10:55 -0800 | [diff] [blame] | 53 | verifier::PcToReferenceMap map(m->GetGcMap(), m->GetGcMapLength()); |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 54 | |
| 55 | if (!pc) { |
| 56 | // pc == NULL: m is either a native method or a phony method |
Elliott Hughes | 530fa00 | 2012-03-12 11:44:49 -0700 | [diff] [blame] | 57 | return true; |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 58 | } |
| 59 | if (m->IsCalleeSaveMethod()) { |
| 60 | LOG(WARNING) << "no PC for " << PrettyMethod(m); |
Elliott Hughes | 530fa00 | 2012-03-12 11:44:49 -0700 | [diff] [blame] | 61 | return true; |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 62 | } |
| 63 | |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 64 | // Enable this to dump reference map to LOG(INFO) |
| 65 | if (false) { |
| 66 | ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable); |
| 67 | art::verifier::DexVerifier::VerifyMethodAndDump(m); |
| 68 | } |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 69 | const uint8_t* ref_bitmap = NULL; |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 70 | MethodHelper mh(m); |
| 71 | std::string m_name(mh.GetName()); |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 72 | |
| 73 | // Given the method name and the number of times the method has been called, |
| 74 | // we know the Dex registers with live reference values. Assert that what we |
| 75 | // find is what is expected. |
| 76 | if (m_name.compare("f") == 0) { |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 77 | ref_bitmap = map.FindBitMap(0x03U); |
| 78 | CHECK(ref_bitmap); |
| 79 | CHECK_REGS_CONTAIN_REFS(8); // v8: this |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 80 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 81 | ref_bitmap = map.FindBitMap(0x06U); |
| 82 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 83 | CHECK_REGS_CONTAIN_REFS(8, 1); // v8: this, v1: x |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 84 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 85 | ref_bitmap = map.FindBitMap(0x08U); |
| 86 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 87 | CHECK_REGS_CONTAIN_REFS(8, 3, 1); // v8: this, v3: y, v1: x |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 88 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 89 | ref_bitmap = map.FindBitMap(0x0cU); |
| 90 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 91 | CHECK_REGS_CONTAIN_REFS(8, 3, 1); // v8: this, v3: y, v1: x |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 92 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 93 | ref_bitmap = map.FindBitMap(0x0eU); |
| 94 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 95 | CHECK_REGS_CONTAIN_REFS(8, 3, 1); // v8: this, v3: y, v1: x |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 96 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 97 | ref_bitmap = map.FindBitMap(0x10U); |
| 98 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 99 | CHECK_REGS_CONTAIN_REFS(8, 3, 1); // v8: this, v3: y, v1: x |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 100 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 101 | ref_bitmap = map.FindBitMap(0x13U); |
| 102 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 103 | // v2 is added because of the instruction at DexPC 0024. Object merges with 0 is Object. See: |
| 104 | // 0024: move-object v3, v2 |
| 105 | // 0025: goto 0013 |
| 106 | // Detaled dex instructions for ReferenceMap.java are at the end of this function. |
| 107 | CHECK_REGS_CONTAIN_REFS(8, 3, 2, 1); // v8: this, v3: y, v2: y, v1: x |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 108 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 109 | ref_bitmap = map.FindBitMap(0x15U); |
| 110 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 111 | CHECK_REGS_CONTAIN_REFS(8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 112 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 113 | ref_bitmap = map.FindBitMap(0x18U); |
| 114 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 115 | CHECK_REGS_CONTAIN_REFS(8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 116 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 117 | ref_bitmap = map.FindBitMap(0x1aU); |
| 118 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 119 | CHECK_REGS_CONTAIN_REFS(8, 5, 2, 1, 0); // v8: this, v5: x[1], v2: y, v1: x, v0: ex |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 120 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 121 | ref_bitmap = map.FindBitMap(0x1dU); |
| 122 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 123 | CHECK_REGS_CONTAIN_REFS(8, 5, 2, 1, 0); // v8: this, v5: x[1], v2: y, v1: x, v0: ex |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 124 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 125 | ref_bitmap = map.FindBitMap(0x1fU); |
| 126 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 127 | // v5 is removed from the root set because there is a "merge" operation. |
| 128 | // See 0015: if-nez v2, 001f. |
| 129 | CHECK_REGS_CONTAIN_REFS(8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 130 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 131 | ref_bitmap = map.FindBitMap(0x21U); |
| 132 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 133 | CHECK_REGS_CONTAIN_REFS(8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 134 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 135 | ref_bitmap = map.FindBitMap(0x25U); |
| 136 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 137 | CHECK_REGS_CONTAIN_REFS(8, 3, 2, 1, 0); // v8: this, v3: y, v2: y, v1: x, v0: ex |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 138 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 139 | ref_bitmap = map.FindBitMap(0x27U); |
| 140 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 141 | CHECK_REGS_CONTAIN_REFS(8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 142 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 143 | ref_bitmap = map.FindBitMap(0x29U); |
| 144 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 145 | CHECK_REGS_CONTAIN_REFS(8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 146 | |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 147 | ref_bitmap = map.FindBitMap(0x2cU); |
| 148 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 149 | CHECK_REGS_CONTAIN_REFS(8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 150 | |
| 151 | ref_bitmap = map.FindBitMap(0x2fU); |
| 152 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 153 | CHECK_REGS_CONTAIN_REFS(8, 4, 3, 2, 1); // v8: this, v4: ex, v3: y, v2: y, v1: x |
Shih-wei Liao | 39723d3 | 2011-10-24 02:20:31 -0700 | [diff] [blame] | 154 | |
| 155 | ref_bitmap = map.FindBitMap(0x32U); |
| 156 | CHECK(ref_bitmap); |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 157 | CHECK_REGS_CONTAIN_REFS(8, 3, 2, 1, 0); // v8: this, v3: y, v2: y, v1: x, v0: ex |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 158 | } |
Elliott Hughes | 530fa00 | 2012-03-12 11:44:49 -0700 | [diff] [blame] | 159 | |
| 160 | return true; |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 161 | } |
| 162 | }; |
| 163 | |
Shih-wei Liao | 371814f | 2011-10-27 16:52:10 -0700 | [diff] [blame] | 164 | // Dex instructions for the function 'f' in ReferenceMap.java |
| 165 | // Virtual methods - |
| 166 | // #0 : (in LReferenceMap;) |
| 167 | // name : 'f' |
| 168 | // type : '()Ljava/lang/Object;' |
| 169 | // access : 0x0000 () |
| 170 | // code - |
| 171 | // registers : 9 |
| 172 | // ins : 1 |
| 173 | // outs : 2 |
| 174 | // insns size : 51 16-bit code units |
| 175 | // |[0001e8] ReferenceMap.f:()Ljava/lang/Object; |
| 176 | // |0000: const/4 v4, #int 2 // #2 |
| 177 | // |0001: const/4 v7, #int 0 // #0 |
| 178 | // |0002: const/4 v6, #int 1 // #1 |
| 179 | // |
| 180 | //0:[Unknown],1:[Unknown],2:[Unknown],3:[Unknown],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 181 | // |0003: new-array v1, v4, [Ljava/lang/Object; // type@0007 |
| 182 | // |0005: const/4 v2, #int 0 // #0 |
| 183 | |
| 184 | //0:[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Unknown],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 185 | // |0006: new-instance v3, Ljava/lang/Object; // type@0003 |
| 186 | |
| 187 | //[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Uninitialized Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 188 | // |0008: +invoke-object-init/range {}, Ljava/lang/Object;.<init>:()V // method@0005 |
| 189 | // |000b: const/4 v4, #int 2 // #2 |
| 190 | |
| 191 | //0:[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 192 | // |000c: aput-object v3, v1, v4 |
| 193 | |
| 194 | //0:[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 195 | // |000e: aput-object v3, v1, v6 |
| 196 | |
| 197 | //0:[Unknown],1:[Reference: java.lang.Object[]],2:[Zero],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 198 | // |0010: +invoke-virtual-quick {v8, v7}, [000c] // vtable #000c |
| 199 | |
| 200 | //0:[Conflict],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 201 | // |0013: return-object v3 |
| 202 | // |0014: move-exception v0 |
| 203 | |
| 204 | //0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 205 | // |0015: if-nez v2, 001f // +000a |
| 206 | // |0017: const/4 v4, #int 1 // #1 |
| 207 | |
| 208 | //0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 1],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 209 | // |0018: new-instance v5, Ljava/lang/Object; // type@0003 |
| 210 | |
| 211 | //0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 1],5:[Uninitialized Reference: java.lang.Object],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 212 | // |001a: +invoke-object-init/range {}, Ljava/lang/Object;.<init>:()V // method@0005 |
| 213 | |
| 214 | //0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 1],5:[Reference: java.lang.Object],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 215 | // |001d: aput-object v5, v1, v4 |
| 216 | |
| 217 | //0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 2],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 218 | // |001f: aput-object v2, v1, v6 |
| 219 | |
| 220 | //0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[32-bit Constant: 2],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 221 | // |0021: +invoke-virtual-quick {v8, v7}, [000c] // vtable #000c |
| 222 | // |0024: move-object v3, v2 |
| 223 | |
| 224 | //0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 225 | // |0025: goto 0013 // -0012 |
| 226 | // |0026: move-exception v4 |
| 227 | |
| 228 | //0:[Conflict],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[Reference: java.lang.Throwable],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 229 | // |0027: aput-object v2, v1, v6 |
| 230 | |
| 231 | //0:[Conflict],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[Reference: java.lang.Throwable],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 232 | // |0029: +invoke-virtual-quick {v8, v7}, [000c] // vtable #000c |
| 233 | |
| 234 | //0:[Conflict],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Conflict],4:[Reference: java.lang.Throwable],5:[Conflict],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 235 | // |002c: throw v4 |
| 236 | // |002d: move-exception v4 |
| 237 | // |002e: move-object v2, v3 |
| 238 | |
| 239 | //0:[Unknown],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Reference: java.lang.Object],4:[Reference: java.lang.Throwable],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 240 | // |002f: goto 0027 // -0008 |
| 241 | // |0030: move-exception v0 |
| 242 | // |0031: move-object v2, v3 |
| 243 | |
| 244 | //0:[Reference: java.lang.Exception],1:[Reference: java.lang.Object[]],2:[Reference: java.lang.Object],3:[Reference: java.lang.Object],4:[32-bit Constant: 2],5:[Unknown],6:[32-bit Constant: 1],7:[Zero],8:[Reference: ReferenceMap], |
| 245 | // |0032: goto 0015 // -001d |
| 246 | // catches : 3 |
| 247 | // 0x0006 - 0x000b |
| 248 | // Ljava/lang/Exception; -> 0x0014 |
| 249 | // <any> -> 0x0026 |
| 250 | // 0x000c - 0x000e |
| 251 | // Ljava/lang/Exception; -> 0x0030 |
| 252 | // <any> -> 0x002d |
| 253 | // 0x0018 - 0x001f |
| 254 | // <any> -> 0x0026 |
| 255 | // positions : |
| 256 | // 0x0003 line=8 |
| 257 | // 0x0005 line=9 |
| 258 | // 0x0006 line=11 |
| 259 | // 0x000b line=12 |
| 260 | // 0x000e line=18 |
| 261 | // 0x0010 line=19 |
| 262 | // 0x0013 line=21 |
| 263 | // 0x0014 line=13 |
| 264 | // 0x0015 line=14 |
| 265 | // 0x0017 line=15 |
| 266 | // 0x001f line=18 |
| 267 | // 0x0021 line=19 |
| 268 | // 0x0025 line=20 |
| 269 | // 0x0026 line=18 |
| 270 | // 0x0029 line=19 |
| 271 | // 0x002d line=18 |
| 272 | // 0x0030 line=13 |
| 273 | // locals : |
| 274 | // 0x0006 - 0x000b reg=2 y Ljava/lang/Object; |
| 275 | // 0x000b - 0x0013 reg=3 y Ljava/lang/Object; |
| 276 | // 0x0014 - 0x0015 reg=2 y Ljava/lang/Object; |
| 277 | // 0x0015 - 0x0026 reg=0 ex Ljava/lang/Exception; |
| 278 | // 0x002d - 0x0032 reg=3 y Ljava/lang/Object; |
| 279 | // 0x0005 - 0x0033 reg=1 x [Ljava/lang/Object; |
| 280 | // 0x0032 - 0x0033 reg=2 y Ljava/lang/Object; |
| 281 | // 0x0000 - 0x0033 reg=8 this LReferenceMap; |
| 282 | |
Elliott Hughes | 1bac54f | 2012-03-16 12:48:31 -0700 | [diff] [blame^] | 283 | extern "C" JNIEXPORT jint JNICALL Java_ReferenceMap_refmap(JNIEnv*, jobject, jint count) { |
Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame] | 284 | // Visitor |
| 285 | ReferenceMap2Visitor mapper; |
| 286 | Thread::Current()->WalkStack(&mapper); |
| 287 | |
| 288 | return count + 1; |
| 289 | } |
| 290 | |
| 291 | } |