aboutsummaryrefslogtreecommitdiff
path: root/lang/hermes/files
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2020-09-11 08:04:14 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2020-09-11 08:04:14 +0000
commitf05a6f94a36b3d2d5e77a23e4f30139477cbeda9 (patch)
tree2ef04902904e0e13482380c966642cdf70d05b53 /lang/hermes/files
parent96d7c51d8eb54c5cf784938ab6c85994588372f1 (diff)
downloadports-f05a6f94a36b3d2d5e77a23e4f30139477cbeda9.tar.gz
ports-f05a6f94a36b3d2d5e77a23e4f30139477cbeda9.zip
New port: lang/hermes: JavaScript engine
Notes
Notes: svn path=/head/; revision=548229
Diffstat (limited to 'lang/hermes/files')
-rw-r--r--lang/hermes/files/patch-lib_Support_OSCompatPosix.cpp54
-rw-r--r--lang/hermes/files/patch-lib_VM_Instrumentation_ProcessStats.cpp11
2 files changed, 65 insertions, 0 deletions
diff --git a/lang/hermes/files/patch-lib_Support_OSCompatPosix.cpp b/lang/hermes/files/patch-lib_Support_OSCompatPosix.cpp
new file mode 100644
index 000000000000..1ec6a303b9a4
--- /dev/null
+++ b/lang/hermes/files/patch-lib_Support_OSCompatPosix.cpp
@@ -0,0 +1,54 @@
+--- lib/Support/OSCompatPosix.cpp.orig 2020-08-03 19:19:06 UTC
++++ lib/Support/OSCompatPosix.cpp
+@@ -23,6 +23,11 @@
+ #endif
+ #endif // __linux__
+
++#if defined(__FreeBSD__)
++#include <pthread.h>
++#include <pthread_np.h>
++#endif
++
+ #include <sys/types.h>
+ #include <unistd.h>
+
+@@ -213,7 +218,7 @@ void vm_unused(void *p, size_t sz) {
+ /// the process's physical footprint.
+ #define MADV_UNUSED MADV_FREE
+
+-#elif defined(__linux__)
++#elif defined(__linux__) || defined(__FreeBSD__)
+
+ /// On linux, telling the OS that we \p MADV_DONTNEED some pages will cause it
+ /// to immediately deduct their size from the process's resident set.
+@@ -414,6 +419,12 @@ uint64_t thread_id() {
+ return syscall(__NR_gettid);
+ }
+
++#elif defined(__FreeBSD__)
++
++uint64_t thread_id() {
++ return reinterpret_cast<uint64_t>(pthread_self());
++}
++
+ #else
+ #error "Thread ID not supported on this platform"
+ #endif
+@@ -443,7 +454,7 @@ std::chrono::microseconds thread_cpu_time() {
+ return microseconds(total);
+ }
+
+-#elif defined(__linux__) // !(__APPLE__ && __MACH__)
++#elif defined(__linux__) || defined(__FreeBSD__) // !(__APPLE__ && __MACH__)
+
+ std::chrono::microseconds thread_cpu_time() {
+ using namespace std::chrono;
+@@ -480,7 +491,7 @@ bool thread_page_fault_count(int64_t *outMinorFaults,
+ return kr == KERN_SUCCESS;
+ }
+
+-#elif defined(__linux__) // !(__APPLE__ && __MACH__)
++#elif defined(__linux__) || defined(__FreeBSD__) // !(__APPLE__ && __MACH__)
+
+ bool thread_page_fault_count(int64_t *outMinorFaults, int64_t *outMajorFaults) {
+ struct rusage stats = {};
diff --git a/lang/hermes/files/patch-lib_VM_Instrumentation_ProcessStats.cpp b/lang/hermes/files/patch-lib_VM_Instrumentation_ProcessStats.cpp
new file mode 100644
index 000000000000..584ac722c250
--- /dev/null
+++ b/lang/hermes/files/patch-lib_VM_Instrumentation_ProcessStats.cpp
@@ -0,0 +1,11 @@
+--- lib/VM/Instrumentation/ProcessStats.cpp.orig 2020-09-11 02:29:31 UTC
++++ lib/VM/Instrumentation/ProcessStats.cpp
+@@ -69,6 +69,8 @@ ProcessStats::Info getProcessStatSnapshot() {
+ va *= PS / 1024;
+ #elif defined(__EMSCRIPTEN__)
+ rss = va = 0;
++#elif defined(__FreeBSD__)
++ rss = va = 0; // TODO implement getProcessStatSnapshot
+ #else
+ #error "Unsupported platform"
+ #endif