66 oop get_oop() const { |
67 oop get_oop() const { |
67 assert(_handle != NULL, "null oop"); |
68 assert(_handle != NULL, "null oop"); |
68 return JNIHandles::resolve_non_null(_handle); |
69 return JNIHandles::resolve_non_null(_handle); |
69 } |
70 } |
70 |
71 |
71 void set_perm() { |
72 void init_flags_from(oop x) { |
72 _ident |= PERM_FLAG; |
73 int flags = 0; |
|
74 if (x != NULL) { |
|
75 if (x->is_perm()) |
|
76 flags |= PERM_FLAG; |
|
77 if (x->is_scavengable()) |
|
78 flags |= SCAVENGABLE_FLAG; |
|
79 } |
|
80 _ident |= flags; |
73 } |
81 } |
74 |
82 |
75 // Virtual behavior of the print() method. |
83 // Virtual behavior of the print() method. |
76 virtual void print_impl(outputStream* st) {} |
84 virtual void print_impl(outputStream* st) {} |
77 |
85 |
89 bool equals(ciObject* obj); |
97 bool equals(ciObject* obj); |
90 |
98 |
91 // A hash value for the convenience of compilers. |
99 // A hash value for the convenience of compilers. |
92 int hash(); |
100 int hash(); |
93 |
101 |
94 // Tells if this oop has an encoding. (I.e., is it null or perm?) |
102 // Tells if this oop has an encoding as a constant. |
|
103 // True if is_scavengable is false. |
|
104 // Also true if ScavengeRootsInCode is non-zero. |
95 // If it does not have an encoding, the compiler is responsible for |
105 // If it does not have an encoding, the compiler is responsible for |
96 // making other arrangements for dealing with the oop. |
106 // making other arrangements for dealing with the oop. |
97 // See ciEnv::make_perm_array |
107 // See ciEnv::make_array |
98 bool has_encoding(); |
108 bool can_be_constant(); |
|
109 |
|
110 // Tells if this oop should be made a constant. |
|
111 // True if is_scavengable is false or ScavengeRootsInCode > 1. |
|
112 bool should_be_constant(); |
99 |
113 |
100 // Is this object guaranteed to be in the permanent part of the heap? |
114 // Is this object guaranteed to be in the permanent part of the heap? |
101 // If so, CollectedHeap::can_elide_permanent_oop_store_barriers is relevant. |
115 // If so, CollectedHeap::can_elide_permanent_oop_store_barriers is relevant. |
102 // If the answer is false, no guarantees are made. |
116 // If the answer is false, no guarantees are made. |
103 bool is_perm() { return (_ident & PERM_FLAG) != 0; } |
117 bool is_perm() { return (_ident & PERM_FLAG) != 0; } |
|
118 |
|
119 // Might this object possibly move during a scavenge operation? |
|
120 // If the answer is true and ScavengeRootsInCode==0, the oop cannot be embedded in code. |
|
121 bool is_scavengable() { return (_ident & SCAVENGABLE_FLAG) != 0; } |
104 |
122 |
105 // The address which the compiler should embed into the |
123 // The address which the compiler should embed into the |
106 // generated code to represent this oop. This address |
124 // generated code to represent this oop. This address |
107 // is not the true address of the oop -- it will get patched |
125 // is not the true address of the oop -- it will get patched |
108 // during nmethod creation. |
126 // during nmethod creation. |
109 // |
127 // |
110 // Usage note: no address arithmetic allowed. Oop must |
128 // Usage note: no address arithmetic allowed. Oop must |
111 // be registered with the oopRecorder. |
129 // be registered with the oopRecorder. |
112 jobject encoding(); |
130 jobject constant_encoding(); |
113 |
131 |
114 // What kind of ciObject is this? |
132 // What kind of ciObject is this? |
115 virtual bool is_null_object() const { return false; } |
133 virtual bool is_null_object() const { return false; } |
116 virtual bool is_instance() { return false; } |
134 virtual bool is_instance() { return false; } |
117 virtual bool is_method() { return false; } |
135 virtual bool is_method() { return false; } |