Ignore:
Timestamp:
Oct 3, 2005, 6:43:58 PM (20 years ago)
Author:
mjs
Message:

Patch from George Staikos <[email protected]>, reviewed and tweaked a bit by me.

http://bugzilla.opendarwin.org/show_bug.cgi?id=5174
Add support for compiling on Linux (likely to help for other POSIX systems too)

  • kjs/collector.cpp: (KJS::Collector::markCurrentThreadConservatively): (KJS::Collector::markOtherThreadConservatively):
  • kjs/config.h:
  • kjs/date_object.cpp: (KJS::formatDate): (KJS::formatDateUTCVariant): (KJS::formatTime): (KJS::timeZoneOffset): (KJS::DateProtoFuncImp::callAsFunction): (KJS::DateObjectImp::construct): (KJS::DateObjectImp::callAsFunction): (KJS::makeTime):
  • kjs/identifier.cpp:
  • kjs/internal.cpp: (KJS::initializeInterpreterLock): (KJS::lockInterpreter): (KJS::unlockInterpreter): (KJS::UndefinedImp::toPrimitive): (KJS::UndefinedImp::toBoolean): (KJS::UndefinedImp::toNumber): (KJS::UndefinedImp::toString): (KJS::NullImp::toPrimitive): (KJS::NullImp::toBoolean): (KJS::NullImp::toNumber): (KJS::NullImp::toString): (KJS::BooleanImp::toPrimitive): (KJS::BooleanImp::toBoolean): (KJS::BooleanImp::toNumber): (KJS::BooleanImp::toString): (KJS::StringImp::toPrimitive): (KJS::StringImp::toBoolean): (KJS::StringImp::toNumber): (KJS::StringImp::toString):
  • kjs/internal.h:
  • kjs/protected_values.cpp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/collector.cpp

    r10701 r10713  
    3232#include <algorithm>
    3333
    34 #if !WIN32
     34#if __APPLE__
    3535
    3636#include <CoreFoundation/CoreFoundation.h>
     
    4040#include <mach/thread_act.h>
    4141
     42#elif WIN32
     43
     44#include <windows.h>
     45
    4246#else
    4347
    44 #include <windows.h>
     48#include <pthread.h>
    4549
    4650#endif
     
    292296    setjmp(registers);
    293297
    294 #if !WIN32
     298#if __APPLE__
    295299    pthread_t thread = pthread_self();
    296300    void *stackBase = pthread_get_stackaddr_np(thread);
    297 #else
     301#elif WIN32
    298302    NT_TIB *pTib;
    299303    __asm {
     
    302306    }
    303307    void *stackBase = (void *)pTib->StackBase;
     308#else
     309    void *stackBase = 0;
     310    pthread_attr_t sattr;
     311    // FIXME: this function is non-portable; other POSIX systems may have different np alternatives
     312    pthread_getattr_np(pthread_self(), &sattr);
     313    // Should work but fails on Linux (?)
     314    //  pthread_attr_getstack(&sattr, &stackBase, &stackSize);
     315    pthread_attr_getstackaddr(&sattr, &stackBase);
     316    assert(stackBase);
    304317#endif
    305318
     
    318331  thread_suspend(thread->machThread);
    319332
    320 #if defined(__i386__)
     333#if __i386__
    321334  i386_thread_state_t regs;
    322335  unsigned user_count = sizeof(regs)/sizeof(int);
    323336  thread_state_flavor_t flavor = i386_THREAD_STATE;
    324 #elif defined(__ppc__)
     337#elif __ppc__
    325338  ppc_thread_state_t  regs;
    326339  unsigned user_count = PPC_THREAD_STATE_COUNT;
    327340  thread_state_flavor_t flavor = PPC_THREAD_STATE;
    328 #elif defined(__ppc64__)
     341#elif __ppc64__
    329342  ppc_thread_state64_t  regs;
    330343  unsigned user_count = PPC_THREAD_STATE64_COUNT;
     
    340353 
    341354  // scan the stack
    342 #if defined(__i386__)
     355#if __i386__
    343356  markStackObjectsConservatively((void *)regs.esp, pthread_get_stackaddr_np(thread->posixThread));
    344357#elif defined(__ppc__) || defined(__ppc64__)
Note: See TracChangeset for help on using the changeset viewer.