114 return offset_offset;
115 }
116 static int hash_offset_in_bytes() {
117 assert(initialized && (hash_offset > 0), "Must be initialized");
118 return hash_offset;
119 }
120
121 static void set_value(oop string, typeArrayOop buffer) {
122 assert(initialized && (value_offset > 0), "Must be initialized");
123 string->obj_field_put(value_offset, (oop)buffer);
124 }
125 static void set_hash(oop string, unsigned int hash) {
126 assert(initialized && (hash_offset > 0), "Must be initialized");
127 string->int_field_put(hash_offset, hash);
128 }
129
130 // Accessors
131 static typeArrayOop value(oop java_string) {
132 assert(initialized && (value_offset > 0), "Must be initialized");
133 assert(is_instance(java_string), "must be java_string");
134 return (typeArrayOop) java_string->obj_field(value_offset);
135 }
136 static unsigned int hash(oop java_string) {
137 assert(initialized && (hash_offset > 0), "Must be initialized");
138 assert(is_instance(java_string), "must be java_string");
139 return java_string->int_field(hash_offset);
140 }
141 static int offset(oop java_string) {
142 assert(initialized, "Must be initialized");
143 assert(is_instance(java_string), "must be java_string");
144 if (offset_offset > 0) {
145 return java_string->int_field(offset_offset);
146 } else {
147 return 0;
148 }
149 }
150 static int length(oop java_string) {
151 assert(initialized, "Must be initialized");
152 assert(is_instance(java_string), "must be java_string");
153 if (count_offset > 0) {
154 return java_string->int_field(count_offset);
328 static int _priority_offset;
329 static int _eetop_offset;
330 static int _daemon_offset;
331 static int _stillborn_offset;
332 static int _stackSize_offset;
333 static int _tid_offset;
334 static int _thread_status_offset;
335 static int _park_blocker_offset;
336 static int _park_event_offset ;
337
338 static void compute_offsets();
339
340 public:
341 // Instance creation
342 static oop create();
343 // Returns the JavaThread associated with the thread obj
344 static JavaThread* thread(oop java_thread);
345 // Set JavaThread for instance
346 static void set_thread(oop java_thread, JavaThread* thread);
347 // Name
348 static typeArrayOop name(oop java_thread);
349 static void set_name(oop java_thread, typeArrayOop name);
350 // Priority
351 static ThreadPriority priority(oop java_thread);
352 static void set_priority(oop java_thread, ThreadPriority priority);
353 // Thread group
354 static oop threadGroup(oop java_thread);
355 // Stillborn
356 static bool is_stillborn(oop java_thread);
357 static void set_stillborn(oop java_thread);
358 // Alive (NOTE: this is not really a field, but provides the correct
359 // definition without doing a Java call)
360 static bool is_alive(oop java_thread);
361 // Daemon
362 static bool is_daemon(oop java_thread);
363 static void set_daemon(oop java_thread);
364 // Context ClassLoader
365 static oop context_class_loader(oop java_thread);
366 // Control context
367 static oop inherited_access_control_context(oop java_thread);
368 // Stack size hint
369 static jlong stackSize(oop java_thread);
|
114 return offset_offset;
115 }
116 static int hash_offset_in_bytes() {
117 assert(initialized && (hash_offset > 0), "Must be initialized");
118 return hash_offset;
119 }
120
121 static void set_value(oop string, typeArrayOop buffer) {
122 assert(initialized && (value_offset > 0), "Must be initialized");
123 string->obj_field_put(value_offset, (oop)buffer);
124 }
125 static void set_hash(oop string, unsigned int hash) {
126 assert(initialized && (hash_offset > 0), "Must be initialized");
127 string->int_field_put(hash_offset, hash);
128 }
129
130 // Accessors
131 static typeArrayOop value(oop java_string) {
132 assert(initialized && (value_offset > 0), "Must be initialized");
133 assert(is_instance(java_string), "must be java_string");
134 oop value = java_string->obj_field(value_offset);
135 assert((value->is_typeArray() && TypeArrayKlass::cast(value->klass())->element_type() == T_CHAR), "expect char[]");
136 return typeArrayOop(value);
137 }
138 static unsigned int hash(oop java_string) {
139 assert(initialized && (hash_offset > 0), "Must be initialized");
140 assert(is_instance(java_string), "must be java_string");
141 return java_string->int_field(hash_offset);
142 }
143 static int offset(oop java_string) {
144 assert(initialized, "Must be initialized");
145 assert(is_instance(java_string), "must be java_string");
146 if (offset_offset > 0) {
147 return java_string->int_field(offset_offset);
148 } else {
149 return 0;
150 }
151 }
152 static int length(oop java_string) {
153 assert(initialized, "Must be initialized");
154 assert(is_instance(java_string), "must be java_string");
155 if (count_offset > 0) {
156 return java_string->int_field(count_offset);
330 static int _priority_offset;
331 static int _eetop_offset;
332 static int _daemon_offset;
333 static int _stillborn_offset;
334 static int _stackSize_offset;
335 static int _tid_offset;
336 static int _thread_status_offset;
337 static int _park_blocker_offset;
338 static int _park_event_offset ;
339
340 static void compute_offsets();
341
342 public:
343 // Instance creation
344 static oop create();
345 // Returns the JavaThread associated with the thread obj
346 static JavaThread* thread(oop java_thread);
347 // Set JavaThread for instance
348 static void set_thread(oop java_thread, JavaThread* thread);
349 // Name
350 static oop name(oop java_thread);
351 static void set_name(oop java_thread, oop name);
352 // Priority
353 static ThreadPriority priority(oop java_thread);
354 static void set_priority(oop java_thread, ThreadPriority priority);
355 // Thread group
356 static oop threadGroup(oop java_thread);
357 // Stillborn
358 static bool is_stillborn(oop java_thread);
359 static void set_stillborn(oop java_thread);
360 // Alive (NOTE: this is not really a field, but provides the correct
361 // definition without doing a Java call)
362 static bool is_alive(oop java_thread);
363 // Daemon
364 static bool is_daemon(oop java_thread);
365 static void set_daemon(oop java_thread);
366 // Context ClassLoader
367 static oop context_class_loader(oop java_thread);
368 // Control context
369 static oop inherited_access_control_context(oop java_thread);
370 // Stack size hint
371 static jlong stackSize(oop java_thread);
|