Mercurial > hg > graal-compiler
comparison src/share/vm/opto/compile.cpp @ 4760:669f6a7d5b70
7121073: secondary_super_cache memory slice has incorrect bounds in flatten_alias_type
Reviewed-by: kvn
author | never |
---|---|
date | Mon, 19 Dec 2011 14:16:23 -0800 |
parents | 1bd45abaa507 |
children | 069ab3f976d3 |
comparison
equal
deleted
inserted
replaced
4759:127b3692c168 | 4760:669f6a7d5b70 |
---|---|
1280 // Klass pointers to object array klasses need some flattening | 1280 // Klass pointers to object array klasses need some flattening |
1281 const TypeKlassPtr *tk = tj->isa_klassptr(); | 1281 const TypeKlassPtr *tk = tj->isa_klassptr(); |
1282 if( tk ) { | 1282 if( tk ) { |
1283 // If we are referencing a field within a Klass, we need | 1283 // If we are referencing a field within a Klass, we need |
1284 // to assume the worst case of an Object. Both exact and | 1284 // to assume the worst case of an Object. Both exact and |
1285 // inexact types must flatten to the same alias class. | 1285 // inexact types must flatten to the same alias class so |
1286 // Since the flattened result for a klass is defined to be | 1286 // use NotNull as the PTR. |
1287 // precisely java.lang.Object, use a constant ptr. | |
1288 if ( offset == Type::OffsetBot || (offset >= 0 && (size_t)offset < sizeof(Klass)) ) { | 1287 if ( offset == Type::OffsetBot || (offset >= 0 && (size_t)offset < sizeof(Klass)) ) { |
1289 | 1288 |
1290 tj = tk = TypeKlassPtr::make(TypePtr::Constant, | 1289 tj = tk = TypeKlassPtr::make(TypePtr::NotNull, |
1291 TypeKlassPtr::OBJECT->klass(), | 1290 TypeKlassPtr::OBJECT->klass(), |
1292 offset); | 1291 offset); |
1293 } | 1292 } |
1294 | 1293 |
1295 ciKlass* klass = tk->klass(); | 1294 ciKlass* klass = tk->klass(); |
1305 // the primary supertype array and also force them to the supertype cache | 1304 // the primary supertype array and also force them to the supertype cache |
1306 // alias index. Since the same load can reach both, we need to merge | 1305 // alias index. Since the same load can reach both, we need to merge |
1307 // these 2 disparate memories into the same alias class. Since the | 1306 // these 2 disparate memories into the same alias class. Since the |
1308 // primary supertype array is read-only, there's no chance of confusion | 1307 // primary supertype array is read-only, there's no chance of confusion |
1309 // where we bypass an array load and an array store. | 1308 // where we bypass an array load and an array store. |
1310 uint off2 = offset - Klass::primary_supers_offset_in_bytes(); | 1309 int primary_supers_offset = sizeof(klassOopDesc) + Klass::primary_supers_offset_in_bytes(); |
1311 if( offset == Type::OffsetBot || | 1310 if (offset == Type::OffsetBot || |
1312 off2 < Klass::primary_super_limit()*wordSize ) { | 1311 (offset >= primary_supers_offset && |
1313 offset = sizeof(oopDesc) +Klass::secondary_super_cache_offset_in_bytes(); | 1312 offset < (int)(primary_supers_offset + Klass::primary_super_limit() * wordSize)) || |
1313 offset == (int)(sizeof(klassOopDesc) + Klass::secondary_super_cache_offset_in_bytes())) { | |
1314 offset = sizeof(klassOopDesc) + Klass::secondary_super_cache_offset_in_bytes(); | |
1314 tj = tk = TypeKlassPtr::make( TypePtr::NotNull, tk->klass(), offset ); | 1315 tj = tk = TypeKlassPtr::make( TypePtr::NotNull, tk->klass(), offset ); |
1315 } | 1316 } |
1316 } | 1317 } |
1317 | 1318 |
1318 // Flatten all Raw pointers together. | 1319 // Flatten all Raw pointers together. |