comparison src/share/vm/code/dependencies.hpp @ 14505:524b54a7f1b5

8034839: jvm hangs with gc/gctests/LoadUnloadGC test Summary: Provide fast lookup of checked dependencies via hashmap Reviewed-by: kvn, roland
author anoll
date Wed, 26 Feb 2014 11:29:47 +0100
parents 3aaa4b9966f6
children d8041d695d19 3c6ae9109a86
comparison
equal deleted inserted replaced
14461:a13badbb8b8e 14505:524b54a7f1b5
30 #include "ci/ciMethodHandle.hpp" 30 #include "ci/ciMethodHandle.hpp"
31 #include "classfile/systemDictionary.hpp" 31 #include "classfile/systemDictionary.hpp"
32 #include "code/compressedStream.hpp" 32 #include "code/compressedStream.hpp"
33 #include "code/nmethod.hpp" 33 #include "code/nmethod.hpp"
34 #include "utilities/growableArray.hpp" 34 #include "utilities/growableArray.hpp"
35 #include "utilities/hashtable.hpp"
35 36
36 //** Dependencies represent assertions (approximate invariants) within 37 //** Dependencies represent assertions (approximate invariants) within
37 // the runtime system, e.g. class hierarchy changes. An example is an 38 // the runtime system, e.g. class hierarchy changes. An example is an
38 // assertion that a given method is not overridden; another example is 39 // assertion that a given method is not overridden; another example is
39 // that a type has only one concrete subtype. Compiled code which 40 // that a type has only one concrete subtype. Compiled code which
524 525
525 static void print_statistics() PRODUCT_RETURN; 526 static void print_statistics() PRODUCT_RETURN;
526 }; 527 };
527 528
528 529
529 class DependencySignature : public ResourceObj { 530 class DependencySignature : public GenericHashtableEntry<DependencySignature, ResourceObj> {
530 private: 531 private:
531 int _args_count; 532 int _args_count;
532 uintptr_t _argument_hash[Dependencies::max_arg_count]; 533 uintptr_t _argument_hash[Dependencies::max_arg_count];
533 Dependencies::DepType _type; 534 Dependencies::DepType _type;
534
535 535
536 public: 536 public:
537 DependencySignature(Dependencies::DepStream& dep) { 537 DependencySignature(Dependencies::DepStream& dep) {
538 _args_count = dep.argument_count(); 538 _args_count = dep.argument_count();
539 _type = dep.type(); 539 _type = dep.type();
540 for (int i = 0; i < _args_count; i++) { 540 for (int i = 0; i < _args_count; i++) {
541 _argument_hash[i] = dep.get_identifier(i); 541 _argument_hash[i] = dep.get_identifier(i);
542 } 542 }
543 } 543 }
544 544
545 bool equals(const DependencySignature& sig) const; 545 bool equals(DependencySignature* sig) const;
546 uintptr_t key() const { return _argument_hash[0] >> 2; }
546 547
547 int args_count() const { return _args_count; } 548 int args_count() const { return _args_count; }
548 uintptr_t arg(int idx) const { return _argument_hash[idx]; } 549 uintptr_t arg(int idx) const { return _argument_hash[idx]; }
549 Dependencies::DepType type() const { return _type; } 550 Dependencies::DepType type() const { return _type; }
550 }; 551 };
551 552
552 class DependencySignatureBuffer : public StackObj {
553 private:
554 GrowableArray<DependencySignature*>** _signatures;
555
556 public:
557 DependencySignatureBuffer();
558 bool add_if_missing(const DependencySignature& sig);
559 };
560 553
561 // Every particular DepChange is a sub-class of this class. 554 // Every particular DepChange is a sub-class of this class.
562 class DepChange : public StackObj { 555 class DepChange : public StackObj {
563 public: 556 public:
564 // What kind of DepChange is this? 557 // What kind of DepChange is this?