Mercurial > hg > graal-compiler
comparison src/share/vm/classfile/javaClasses.hpp @ 7482:989155e2d07a
Merge with hs25-b15.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Jan 2013 01:34:24 +0100 |
parents | 291ffc492eb6 ade95d680b42 |
children | 3ac7d10a6572 |
comparison
equal
deleted
inserted
replaced
7381:6761a8f854a4 | 7482:989155e2d07a |
---|---|
164 // String.hashCode(). This value is normally calculated in Java code | 164 // String.hashCode(). This value is normally calculated in Java code |
165 // in the String.hashCode method(), but is precomputed for String | 165 // in the String.hashCode method(), but is precomputed for String |
166 // objects in the shared archive file. | 166 // objects in the shared archive file. |
167 // hash P(31) from Kernighan & Ritchie | 167 // hash P(31) from Kernighan & Ritchie |
168 // | 168 // |
169 // For this reason, THIS ALGORITHM MUST MATCH String.toHash(). | 169 // For this reason, THIS ALGORITHM MUST MATCH String.hashCode(). |
170 template <typename T> static unsigned int to_hash(T* s, int len) { | 170 template <typename T> static unsigned int hash_code(T* s, int len) { |
171 unsigned int h = 0; | 171 unsigned int h = 0; |
172 while (len-- > 0) { | 172 while (len-- > 0) { |
173 h = 31*h + (unsigned int) *s; | 173 h = 31*h + (unsigned int) *s; |
174 s++; | 174 s++; |
175 } | 175 } |
176 return h; | 176 return h; |
177 } | 177 } |
178 static unsigned int to_hash(oop java_string); | 178 static unsigned int hash_code(oop java_string); |
179 | 179 |
180 // This is the string hash code used by the StringTable, which may be | 180 // This is the string hash code used by the StringTable, which may be |
181 // the same as String.toHash or an alternate hash code. | 181 // the same as String.hashCode or an alternate hash code. |
182 static unsigned int hash_string(oop java_string); | 182 static unsigned int hash_string(oop java_string); |
183 | 183 |
184 static bool equals(oop java_string, jchar* chars, int len); | 184 static bool equals(oop java_string, jchar* chars, int len); |
185 | 185 |
186 // Conversion between '.' and '/' formats | 186 // Conversion between '.' and '/' formats |
562 static int modifiers_offset; | 562 static int modifiers_offset; |
563 static int signature_offset; | 563 static int signature_offset; |
564 static int annotations_offset; | 564 static int annotations_offset; |
565 static int parameter_annotations_offset; | 565 static int parameter_annotations_offset; |
566 static int annotation_default_offset; | 566 static int annotation_default_offset; |
567 static int type_annotations_offset; | |
567 | 568 |
568 static void compute_offsets(); | 569 static void compute_offsets(); |
569 | 570 |
570 public: | 571 public: |
571 // Allocation | 572 // Allocation |
606 static void set_parameter_annotations(oop method, oop value); | 607 static void set_parameter_annotations(oop method, oop value); |
607 | 608 |
608 static bool has_annotation_default_field(); | 609 static bool has_annotation_default_field(); |
609 static oop annotation_default(oop method); | 610 static oop annotation_default(oop method); |
610 static void set_annotation_default(oop method, oop value); | 611 static void set_annotation_default(oop method, oop value); |
612 | |
613 static bool has_type_annotations_field(); | |
614 static oop type_annotations(oop method); | |
615 static void set_type_annotations(oop method, oop value); | |
611 | 616 |
612 // Debugging | 617 // Debugging |
613 friend class JavaClasses; | 618 friend class JavaClasses; |
614 }; | 619 }; |
615 | 620 |
626 static int slot_offset; | 631 static int slot_offset; |
627 static int modifiers_offset; | 632 static int modifiers_offset; |
628 static int signature_offset; | 633 static int signature_offset; |
629 static int annotations_offset; | 634 static int annotations_offset; |
630 static int parameter_annotations_offset; | 635 static int parameter_annotations_offset; |
636 static int type_annotations_offset; | |
631 | 637 |
632 static void compute_offsets(); | 638 static void compute_offsets(); |
633 | 639 |
634 public: | 640 public: |
635 // Allocation | 641 // Allocation |
660 static void set_annotations(oop constructor, oop value); | 666 static void set_annotations(oop constructor, oop value); |
661 | 667 |
662 static bool has_parameter_annotations_field(); | 668 static bool has_parameter_annotations_field(); |
663 static oop parameter_annotations(oop method); | 669 static oop parameter_annotations(oop method); |
664 static void set_parameter_annotations(oop method, oop value); | 670 static void set_parameter_annotations(oop method, oop value); |
671 | |
672 static bool has_type_annotations_field(); | |
673 static oop type_annotations(oop constructor); | |
674 static void set_type_annotations(oop constructor, oop value); | |
665 | 675 |
666 // Debugging | 676 // Debugging |
667 friend class JavaClasses; | 677 friend class JavaClasses; |
668 }; | 678 }; |
669 | 679 |
679 static int type_offset; | 689 static int type_offset; |
680 static int slot_offset; | 690 static int slot_offset; |
681 static int modifiers_offset; | 691 static int modifiers_offset; |
682 static int signature_offset; | 692 static int signature_offset; |
683 static int annotations_offset; | 693 static int annotations_offset; |
694 static int type_annotations_offset; | |
684 | 695 |
685 static void compute_offsets(); | 696 static void compute_offsets(); |
686 | 697 |
687 public: | 698 public: |
688 // Allocation | 699 // Allocation |
718 | 729 |
719 static bool has_annotation_default_field(); | 730 static bool has_annotation_default_field(); |
720 static oop annotation_default(oop method); | 731 static oop annotation_default(oop method); |
721 static void set_annotation_default(oop method, oop value); | 732 static void set_annotation_default(oop method, oop value); |
722 | 733 |
723 // Debugging | 734 static bool has_type_annotations_field(); |
735 static oop type_annotations(oop field); | |
736 static void set_type_annotations(oop field, oop value); | |
737 | |
738 // Debugging | |
739 friend class JavaClasses; | |
740 }; | |
741 | |
742 class java_lang_reflect_Parameter { | |
743 private: | |
744 // Note that to reduce dependencies on the JDK we compute these | |
745 // offsets at run-time. | |
746 static int name_offset; | |
747 static int modifiers_offset; | |
748 static int index_offset; | |
749 static int executable_offset; | |
750 | |
751 static void compute_offsets(); | |
752 | |
753 public: | |
754 // Allocation | |
755 static Handle create(TRAPS); | |
756 | |
757 // Accessors | |
758 static oop name(oop field); | |
759 static void set_name(oop field, oop value); | |
760 | |
761 static int index(oop reflect); | |
762 static void set_index(oop reflect, int value); | |
763 | |
764 static int modifiers(oop reflect); | |
765 static void set_modifiers(oop reflect, int value); | |
766 | |
767 static oop executable(oop constructor); | |
768 static void set_executable(oop constructor, oop value); | |
769 | |
724 friend class JavaClasses; | 770 friend class JavaClasses; |
725 }; | 771 }; |
726 | 772 |
727 // Interface to sun.reflect.ConstantPool objects | 773 // Interface to sun.reflect.ConstantPool objects |
728 class sun_reflect_ConstantPool { | 774 class sun_reflect_ConstantPool { |