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