Beispiel #1
0
void IsolateObj::static_int_field_put(int offset, int value) {
  Task::Raw this_task = task();
  GUARANTEE(!this_task.is_null(), "Task is null");
  ObjArray::Raw mirror_list = this_task().mirror_list();
  GUARANTEE(!mirror_list.is_null(), "Null Mirror list");
  TaskMirror::Raw tm =
    mirror_list().obj_at(Universe::isolate_class()->class_id());
  GUARANTEE(!tm.is_null(), "null task mirror");
  tm().int_field_put(offset, value);
}
Beispiel #2
0
jint IsolateObj::static_int_field(int offset) const {
  Task::Raw this_task = task();
  GUARANTEE(!this_task.is_null(), "Task is null");
  ObjArray::Raw mirror_list = this_task().mirror_list();
  GUARANTEE(!mirror_list.is_null(), "Null Mirror list");
  TaskMirror::Raw tm =
    mirror_list().obj_at(Universe::isolate_class()->class_id());
  GUARANTEE(!tm.is_null(), "null task mirror");
  return tm().int_field(offset);
}
Beispiel #3
0
void InstanceClass::set_initialized() {
 TaskMirror::Raw tm;
 tm = task_mirror_desc();
 GUARANTEE(tm.not_null(), "task mirror must not be null");
 if (TaskMirrorDesc::is_being_initialized_mirror((TaskMirrorDesc*)tm.obj())){
   tm = TaskMirror::clinit_list_lookup(this);
   GUARANTEE(tm.not_null(), "task mirror must not be null");
   tm = TaskMirror::clinit_list_remove(this);
 }
 GUARANTEE(tm.not_null(), "task mirror must not be null");
 JavaClassObj::Raw mirror = tm().real_java_mirror();
 GUARANTEE(mirror.not_null(), "mirror must not be null");
 if (mirror().status() == JavaClassObj::ERROR_FLAG) {
         return;
 }
 mirror().set_initialized();
 set_task_mirror(&tm);
}
Beispiel #4
0
  void thread_task_cleanup()  {
    SETUP_ERROR_CHECKER_ARG;
    // We come in here on primordial stack
    UsingFastOops fast_oops;
    Thread *thread = Thread::current();
    // cleanup any taskmirrors awaiting initialization.  They may be
    // on the clinit list because of an exception being thrown during
    // static initialization
    int tid = thread->task_id();
    GUARANTEE(tid >= 0 && tid < MAX_TASKS, "Not a valid task id");
    Task::Fast this_task = Task::get_task(tid);
    GUARANTEE(!this_task.is_null(), "Not a valid task");
    TaskMirror::Raw tm = this_task().clinit_list();
    while (!tm.is_null()) {
      TaskMirror::Raw next = tm().next_in_clinit_list();
      if (tm().init_thread() == thread->obj()) {
        JavaClass::Raw jc = tm().containing_class();
        TaskMirror::clinit_list_remove(&jc);
        Universe::mirror_list()->obj_at_put(jc().class_id(),
                                 Universe::task_class_init_marker());
      }
      tm = next.obj();
    }

    bool all_threads_terminated = this_task().remove_thread();
    if (all_threads_terminated) {
      if (TraceThreadsExcessive) {
        TTY_TRACE_CR(("Cleanup task 0x%x", tid));
      }
      // if this is the last thread of the last task to exit, its
      // exit code will get returned.
      JVM::set_exit_code(this_task().exit_code());
      Thread::clear_current_pending_exception();
      // will invoke task termination to produce events and close links.
      this_task().terminate_current_isolate(thread JVM_NO_CHECK_AT_BOTTOM);
    }
  }