Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add solaris patch file

  • Loading branch information...
commit 02aae22397fe38e70fb488195a035c913c4f71b1 1 parent c9d3a81
ry ry authored

Showing 2 changed files with 103 additions and 1 deletion. Show diff stats Hide diff stats

  1. +0 1  .gitignore
  2. +103 0 deps/v8/0003-Fix-Solaris-build.patch
1  .gitignore
@@ -3,7 +3,6 @@ build
3 3 tags
4 4 .lock-wscript
5 5 *.pyc
6   -*.patch
7 6 doc/api.xml
8 7 tools/nodejs.pc
9 8 test/fixtures/hello.txt
103 deps/v8/0003-Fix-Solaris-build.patch
... ... @@ -0,0 +1,103 @@
  1 +From 2a40926a1e1c8d385afefc1fe5255e21cc1a8f1e Mon Sep 17 00:00:00 2001
  2 +From: Ryan Dahl <ry@tinyclouds.org>
  3 +Date: Thu, 16 Dec 2010 22:20:44 +0000
  4 +Subject: [PATCH] Fix Solaris build
  5 +
  6 +---
  7 + src/platform-solaris.cc | 49 ++++++++++++++++++++++++++++++++++++----------
  8 + src/v8utils.h | 1 +
  9 + 2 files changed, 39 insertions(+), 11 deletions(-)
  10 +
  11 +diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc
  12 +index f84e80d..b302c59 100644
  13 +--- a/src/platform-solaris.cc
  14 ++++ b/src/platform-solaris.cc
  15 +@@ -45,6 +45,7 @@
  16 + #include <errno.h>
  17 + #include <ieeefp.h> // finite()
  18 + #include <signal.h> // sigemptyset(), etc
  19 ++#include <sys/kdi_regs.h>
  20 +
  21 +
  22 + #undef MAP_TYPE
  23 +@@ -481,6 +482,16 @@ class SolarisMutex : public Mutex {
  24 +
  25 + int Unlock() { return pthread_mutex_unlock(&mutex_); }
  26 +
  27 ++ virtual bool TryLock() {
  28 ++ int result = pthread_mutex_trylock(&mutex_);
  29 ++ // Return false if the lock is busy and locking failed.
  30 ++ if (result == EBUSY) {
  31 ++ return false;
  32 ++ }
  33 ++ ASSERT(result == 0); // Verify no other errors.
  34 ++ return true;
  35 ++ }
  36 ++
  37 + private:
  38 + pthread_mutex_t mutex_;
  39 + };
  40 +@@ -572,21 +583,37 @@ Semaphore* OS::CreateSemaphore(int count) {
  41 + #ifdef ENABLE_LOGGING_AND_PROFILING
  42 +
  43 + static Sampler* active_sampler_ = NULL;
  44 ++static pthread_t vm_tid_ = 0;
  45 ++
  46 +
  47 + static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
  48 + USE(info);
  49 + if (signal != SIGPROF) return;
  50 +- if (active_sampler_ == NULL) return;
  51 +-
  52 +- TickSample sample;
  53 +- sample.pc = 0;
  54 +- sample.sp = 0;
  55 +- sample.fp = 0;
  56 +-
  57 +- // We always sample the VM state.
  58 +- sample.state = VMState::current_state();
  59 +-
  60 +- active_sampler_->Tick(&sample);
  61 ++ if (active_sampler_ == NULL || !active_sampler_->IsActive()) return;
  62 ++ if (vm_tid_ != pthread_self()) return;
  63 ++
  64 ++ TickSample sample_obj;
  65 ++ TickSample* sample = CpuProfiler::TickSampleEvent();
  66 ++ if (sample == NULL) sample = &sample_obj;
  67 ++
  68 ++ // Extracting the sample from the context is extremely machine dependent.
  69 ++ ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
  70 ++ mcontext_t& mcontext = ucontext->uc_mcontext;
  71 ++ sample->state = Top::current_vm_state();
  72 ++
  73 ++#if V8_HOST_ARCH_IA32
  74 ++ sample->pc = reinterpret_cast<Address>(mcontext.gregs[KDIREG_EIP]);
  75 ++ sample->sp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_ESP]);
  76 ++ sample->fp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_EBP]);
  77 ++#elif V8_HOST_ARCH_X64
  78 ++ sample->pc = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RIP]);
  79 ++ sample->sp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RSP]);
  80 ++ sample->fp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RBP]);
  81 ++#else
  82 ++ UNIMPLEMENTED();
  83 ++#endif
  84 ++ active_sampler_->SampleStack(sample);
  85 ++ active_sampler_->Tick(sample);
  86 + }
  87 +
  88 +
  89 +diff --git a/src/v8utils.h b/src/v8utils.h
  90 +index f6ed520..59b3898 100644
  91 +--- a/src/v8utils.h
  92 ++++ b/src/v8utils.h
  93 +@@ -29,6 +29,7 @@
  94 + #define V8_V8UTILS_H_
  95 +
  96 + #include "utils.h"
  97 ++#include <stdarg.h>
  98 +
  99 + namespace v8 {
  100 + namespace internal {
  101 +--
  102 +1.6.3.3
  103 +

0 comments on commit 02aae22

Please sign in to comment.
Something went wrong with that request. Please try again.