Mercurial > hg > truffle
comparison src/share/vm/c1/c1_Instruction.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | 7a302948f5a4 |
children | 37c18711a0df |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
394 intx Constant::hash() const { | 394 intx Constant::hash() const { |
395 if (state_before() == NULL) { | 395 if (state_before() == NULL) { |
396 switch (type()->tag()) { | 396 switch (type()->tag()) { |
397 case intTag: | 397 case intTag: |
398 return HASH2(name(), type()->as_IntConstant()->value()); | 398 return HASH2(name(), type()->as_IntConstant()->value()); |
399 case addressTag: | |
400 return HASH2(name(), type()->as_AddressConstant()->value()); | |
399 case longTag: | 401 case longTag: |
400 { | 402 { |
401 jlong temp = type()->as_LongConstant()->value(); | 403 jlong temp = type()->as_LongConstant()->value(); |
402 return HASH3(name(), high(temp), low(temp)); | 404 return HASH3(name(), high(temp), low(temp)); |
403 } | 405 } |
409 return HASH3(name(), high(temp), low(temp)); | 411 return HASH3(name(), high(temp), low(temp)); |
410 } | 412 } |
411 case objectTag: | 413 case objectTag: |
412 assert(type()->as_ObjectType()->is_loaded(), "can't handle unloaded values"); | 414 assert(type()->as_ObjectType()->is_loaded(), "can't handle unloaded values"); |
413 return HASH2(name(), type()->as_ObjectType()->constant_value()); | 415 return HASH2(name(), type()->as_ObjectType()->constant_value()); |
416 case metaDataTag: | |
417 assert(type()->as_MetadataType()->is_loaded(), "can't handle unloaded values"); | |
418 return HASH2(name(), type()->as_MetadataType()->constant_value()); | |
419 default: | |
420 ShouldNotReachHere(); | |
414 } | 421 } |
415 } | 422 } |
416 return 0; | 423 return 0; |
417 } | 424 } |
418 | 425 |
450 } | 457 } |
451 case objectTag: | 458 case objectTag: |
452 { | 459 { |
453 ObjectType* t1 = type()->as_ObjectType(); | 460 ObjectType* t1 = type()->as_ObjectType(); |
454 ObjectType* t2 = v->type()->as_ObjectType(); | 461 ObjectType* t2 = v->type()->as_ObjectType(); |
462 return (t1 != NULL && t2 != NULL && | |
463 t1->is_loaded() && t2->is_loaded() && | |
464 t1->constant_value() == t2->constant_value()); | |
465 } | |
466 case metaDataTag: | |
467 { | |
468 MetadataType* t1 = type()->as_MetadataType(); | |
469 MetadataType* t2 = v->type()->as_MetadataType(); | |
455 return (t1 != NULL && t2 != NULL && | 470 return (t1 != NULL && t2 != NULL && |
456 t1->is_loaded() && t2->is_loaded() && | 471 t1->is_loaded() && t2->is_loaded() && |
457 t1->constant_value() == t2->constant_value()); | 472 t1->constant_value() == t2->constant_value()); |
458 } | 473 } |
459 } | 474 } |
506 case If::neq: return xvalue != yvalue ? cond_true : cond_false; | 521 case If::neq: return xvalue != yvalue ? cond_true : cond_false; |
507 } | 522 } |
508 } | 523 } |
509 break; | 524 break; |
510 } | 525 } |
526 case metaDataTag: { | |
527 ciMetadata* xvalue = lt->as_MetadataType()->constant_value(); | |
528 ciMetadata* yvalue = rt->as_MetadataType()->constant_value(); | |
529 assert(xvalue != NULL && yvalue != NULL, "not constants"); | |
530 if (xvalue->is_loaded() && yvalue->is_loaded()) { | |
531 switch (cond) { | |
532 case If::eql: return xvalue == yvalue ? cond_true : cond_false; | |
533 case If::neq: return xvalue != yvalue ? cond_true : cond_false; | |
534 } | |
535 } | |
536 break; | |
537 } | |
511 } | 538 } |
512 return not_comparable; | 539 return not_comparable; |
513 } | 540 } |
514 | 541 |
515 | 542 |