コード例 #1
0
char* InliningDatabase::mangle_name(char *str) {
  char* result = NEW_RESOURCE_ARRAY(char, 100);
  int i = 0;
  int j = 0;
  while (str[i] != '\0') {
    int c = str[i];
    if (strchr(quote_string,c)) {
      result[j++] = quote;
      result[j++] = get_unsigned_bitfield(c, 6, 3) + '0';
      result[j++] = get_unsigned_bitfield(c, 3, 3) + '0';
      result[j++] = get_unsigned_bitfield(c, 0, 3) + '0';
    } else if (isupper(c)) {
      result[j++] = quote;
      result[j++] = c + ('a' - 'A');
    } else {
      result[j++] = c;
    } 
    i++;
  }
  result[j++] = '\0';
  return result;
}
コード例 #2
0
ファイル: callBack.cpp プロジェクト: jirkadanek/Strongtalk
extern "C" volatile void* handleCallBack(int index, int params) {
    DeltaProcess* proc = NULL;

    if (Universe::callBack_receiver()->is_nil()) {
        warning("callBack receiver is not set");
    }

    int low  = get_unsigned_bitfield(params,  0, 16);
    int high = get_unsigned_bitfield(params, 16, 16);

    if (DeltaProcess::active()->thread_id() != os::current_thread_id()) {
        // We'are now back in a asynchronous DLL call so give up the control
        // Fix this:
        //   remove warning when it has been tested
        proc = Processes::find_from_thread_id(os::current_thread_id());
        assert(proc, "process must be present");
        DLLs::exit_async_call(&proc);
    }

    DeltaProcess::active()->setIsCallback(true);

    oop res = Delta::call(Universe::callBack_receiver(),
                          Universe::callBack_selector(),
                          as_smiOop(index),
                          as_smiOop(high),
                          as_smiOop(low));

    assert(DeltaProcess::active()->thread_id() == os::current_thread_id(), "check for process torch");

    void* result;

    // convert return result

    if (have_nlr_through_C) {
        // Continues the NLR after at the next Delta frame
        BaseHandle* handle = DeltaProcess::active()->firstHandle();
        if (handle && ((char*) handle < (char*)DeltaProcess::active()->last_Delta_fp()))
            handle->pop();

        ErrorHandler::continue_nlr_in_delta();
    }

    if (res->is_smi()) {
        result = (void*) smiOop(res)->value();
    } else if (res->is_proxy()) {
        result = (void*) proxyOop(res)->get_pointer();
    } else {
        warning("Wrong return type for call back, returning NULL");
        result = NULL;
    }

    // Return value has to be converted before we transfer control to another
    // thread.

    if (proc) {
        // We'are now back in a asynchronous DLL call so give up the control
        proc->resetStepping();
        proc->transfer_and_continue();
    }

    // Call Delta level error routine
    return result;
}