Mercurial > hg > truffle
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 5542:e318468952f5
Remove CiBitMap and replace usages with java.util.BitSet.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 09 Jun 2012 17:13:21 +0200 |
parents | a53162ca8219 |
children | 511612d1b5c1 |
comparison
equal
deleted
inserted
replaced
5541:b4c406861c33 | 5542:e318468952f5 |
---|---|
51 } else { | 51 } else { |
52 return XMM_REGS[graal_reg - NUM_CPU_REGS]->as_VMReg(); | 52 return XMM_REGS[graal_reg - NUM_CPU_REGS]->as_VMReg(); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 const int MapWordBits = 64; | |
57 | |
56 static bool is_bit_set(oop bit_map, int i) { | 58 static bool is_bit_set(oop bit_map, int i) { |
57 const int MapWordBits = 64; | 59 jint extra_idx = i / MapWordBits; |
58 if (i < MapWordBits) { | 60 arrayOop extra = (arrayOop) GraalBitMap::words(bit_map); |
59 jlong low = GraalBitMap::low(bit_map); | 61 assert(extra_idx >= 0 && extra_idx < extra->length(), "unexpected index"); |
60 return (low & (1LL << i)) != 0; | 62 jlong word = ((jlong*) extra->base(T_LONG))[extra_idx]; |
61 } else { | 63 return (word & (1LL << (i % MapWordBits))) != 0; |
62 jint extra_idx = (i - MapWordBits) / MapWordBits; | 64 } |
63 arrayOop extra = (arrayOop) GraalBitMap::extra(bit_map); | 65 |
64 assert(extra_idx >= 0 && extra_idx < extra->length(), "unexpected index"); | 66 static int bitmap_size(oop bit_map) { |
65 jlong word = ((jlong*) extra->base(T_LONG))[extra_idx]; | 67 arrayOop arr = (arrayOop) GraalBitMap::words(bit_map); |
66 return (word & (1LL << (i % MapWordBits))) != 0; | 68 return arr->length() * MapWordBits; |
67 } | |
68 } | 69 } |
69 | 70 |
70 // creates a hotspot oop map out of the byte arrays provided by CiDebugInfo | 71 // creates a hotspot oop map out of the byte arrays provided by CiDebugInfo |
71 static OopMap* create_oop_map(jint total_frame_size, jint parameter_count, oop debug_info) { | 72 static OopMap* create_oop_map(jint total_frame_size, jint parameter_count, oop debug_info) { |
72 OopMap* map = new OopMap(total_frame_size, parameter_count); | 73 OopMap* map = new OopMap(total_frame_size, parameter_count); |
73 oop register_map = (oop) CiDebugInfo::registerRefMap(debug_info); | 74 oop register_map = (oop) CiDebugInfo::registerRefMap(debug_info); |
74 oop frame_map = (oop) CiDebugInfo::frameRefMap(debug_info); | 75 oop frame_map = (oop) CiDebugInfo::frameRefMap(debug_info); |
75 | 76 |
76 if (register_map != NULL) { | 77 if (register_map != NULL) { |
77 assert(GraalBitMap::size(register_map) == (unsigned) NUM_CPU_REGS, "unexpected register_map length"); | |
78 for (jint i = 0; i < NUM_CPU_REGS; i++) { | 78 for (jint i = 0; i < NUM_CPU_REGS; i++) { |
79 bool is_oop = is_bit_set(register_map, i); | 79 bool is_oop = is_bit_set(register_map, i); |
80 VMReg reg = get_hotspot_reg(i); | 80 VMReg reg = get_hotspot_reg(i); |
81 if (is_oop) { | 81 if (is_oop) { |
82 assert(OOP_ALLOWED[i], "this register may never be an oop, register map misaligned?"); | 82 assert(OOP_ALLOWED[i], "this register may never be an oop, register map misaligned?"); |
85 map->set_value(reg); | 85 map->set_value(reg); |
86 } | 86 } |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 for (jint i = 0; i < GraalBitMap::size(frame_map); i++) { | 90 for (jint i = 0; i < bitmap_size(frame_map); i++) { |
91 bool is_oop = is_bit_set(frame_map, i); | 91 bool is_oop = is_bit_set(frame_map, i); |
92 // hotspot stack slots are 4 bytes | 92 // hotspot stack slots are 4 bytes |
93 VMReg reg = VMRegImpl::stack2reg(i * 2); | 93 VMReg reg = VMRegImpl::stack2reg(i * 2); |
94 if (is_oop) { | 94 if (is_oop) { |
95 map->set_oop(reg); | 95 map->set_oop(reg); |