Example #1
0
void F_here(void)
{
  forth_obj tmp;
  set_thread(&tmp, forth_thread_code + thread_index - 1);
  push(tmp, &pstack);
  pc++;
}
Example #2
0
void forth_inner_interpreter(void)
{
  //  dprintf(("begin inner_interpreter\n"));
  do{
     dprintf(("before exec.pc=%p,rstack.index=%d\n", (int*)pc, rstack.index));
    if(pc_end_p(*pc)){
      pc = get_thread(pop(&rstack));
    }else if(prim_p(*pc)){
      dprintf(("prim_p\n"));
      exec_prim(pc);
    }else if(thread_p(*pc)){
      forth_obj tmp;
      set_thread(&tmp, pc + 1);
      dprintf(("thread_p\n"));
      push(tmp, &rstack);
      pc = get_thread((forth_obj)pc->thread);
    }else{
      dprintf(("push pstack\n"));
      push(*pc, &pstack);
      pc++;
    }
    dprintf(("after exec.pc=%p, pc_end_p=(%d),rstack.index=%d\n", 
	     (int*)pc, pc_end_p(*pc), rstack.index));
  }while((!pc_end_p(*pc)) || (rstack.index != 0));
  //  dprintf(("end innner_interpreter\n"));
}
Example #3
0
void F_fetch(void) /* @ */
{
  forth_obj ret, *tmp = get_thread(pop(&pstack));
  set_thread(&ret, tmp);
  push(ret, &pstack);
  pc++;
}
Example #4
0
void ActiveObjectBase::start_thread()
{
    // prevent the started thread from running until the thread id has been assigned
    // so that calls to isCurrentThread() work correctly
    set_thread(std::thread(run_active_object, this));
    while (!started) {
        os_thread_yield();
    }
}
Example #5
0
void F_store(void)/* ! */
{
  forth_obj tmp1 = pop(&pstack),
    tmp2 = pop(&pstack),
    *loc = get_thread(tmp1),
    *thread = get_thread(tmp2);
  //print_thread();
  dprintf(("loc=(%p),loc->(%p),th=(%p),th->(%p)\n",tmp1,loc,tmp2,thread));
  set_thread(loc, thread);
  dprintf(("loc=(%p),loc->(%p),th=(%p),th->(%p)\n",tmp1,loc,tmp2,thread));
  pc++;
}
void StackLock::lock(Thread* thread, JavaOop *obj) {
  AllocationDisabler no_allocation;
  // May not necessarily be the current thread
  GUARANTEE(owner() == NULL || owner() == obj->obj(), "Sanity Check");
  GUARANTEE(thread->is_on_stack((address)this), "Sanity check");

  JavaNear::Raw real_near = obj->klass();
  GUARANTEE(!real_near().is_locked(), "Sanity check");

  // Must not use JavaNear for stack nears.
  JavaNear::Raw stack_near = java_near(&real_near);
  stack_near().set_lock(JavaNear::locked_value);

  // Object is unlocked, so we're free to lock it.
  set_owner(obj);
  set_thread(thread);
  set_real_java_near(&real_near);
  _waiters = NULL;
  obj->set_klass(&stack_near);
  GUARANTEE(Synchronizer::is_locked_by(obj, thread), "Sanity check");
}
Example #7
0
void F_create(void)
{
  forth_obj tmp;
  dprintf(("create! thread=(%p)\n", forth_thread_code + thread_index));
  thread_index++;

  dict[dict_index].name = "";
  dict[dict_index].immediate = FALSE;
  dict[dict_index].thread = forth_thread_code + thread_index;

  set_thread(&tmp, forth_thread_code + thread_index + 2);
  forth_compile_in(tmp);
  thread_index++;
  set_end(forth_thread_code + thread_index);

  dict_index++;
  if(dict_index >= FORTH_DICT_SIZE){
    fprintf(stderr, "dict over flower\n");
    exit(1);
  }
  pc++;
}
Example #8
0
AbstractGangWorker* AbstractWorkGang::install_worker(uint worker_id) {
  AbstractGangWorker* new_worker = allocate_worker(worker_id);
  set_thread(worker_id, new_worker);
  return new_worker;
}