Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 2016 18:13:57 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r406064 - in branches/2016Q1/java/openjdk8: . files
Message-ID:  <201601131813.u0DIDvpn055529@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Wed Jan 13 18:13:57 2016
New Revision: 406064
URL: https://svnweb.freebsd.org/changeset/ports/406064

Log:
  MFH:	r405058, r405320
  
  - Stub implementation of OperatingSystemImpl.
  - Partially implement getThreadUserTime() using getrusage(2).  Note we can
  only get usage for the current thread.  Return -1 if the requested function
  is not supported, i.e., user time for other threads, rather than crash.
  - Properly implement os::elapsedVTime() using getrusage().  Basically, it is
  taken from Linux version.
  - Temporarily revert r403748 to fix bootstrapping with earlier OpenJDK8.
  
  PR:		205229, 205523, 205544, 205843
  Approved by:	ports-secteam (feld)

Added:
  branches/2016Q1/java/openjdk8/files/patch-jdk-src-solaris-native-sun-management-BsdOperatingSystem.c
     - copied unchanged from r405058, head/java/openjdk8/files/patch-jdk-src-solaris-native-sun-management-BsdOperatingSystem.c
Modified:
  branches/2016Q1/java/openjdk8/Makefile
  branches/2016Q1/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp
Directory Properties:
  branches/2016Q1/   (props changed)

Modified: branches/2016Q1/java/openjdk8/Makefile
==============================================================================
--- branches/2016Q1/java/openjdk8/Makefile	Wed Jan 13 17:49:31 2016	(r406063)
+++ branches/2016Q1/java/openjdk8/Makefile	Wed Jan 13 18:13:57 2016	(r406064)
@@ -2,7 +2,7 @@
 
 PORTNAME=	openjdk
 PORTVERSION=	${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//}
-PORTREVISION=	1
+PORTREVISION=	3
 CATEGORIES=	java devel
 MASTER_SITES=	http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}/promoted/b${DIST_BUILD_NUMBER}/:jdk \
 		https://adopt-openjdk.ci.cloudbees.com/job/jtreg/${JTREG_JENKINS_BUILD}/artifact/:jtreg \
@@ -331,10 +331,6 @@ BUILD_DEPENDS+=		${BOOTSTRAPJDKDIR}/bin/
 .  endif
 .endif
 
-.if ${BOOTSTRAPJDKDIR} == ${LOCALBASE}/openjdk8
-CONFIGURE_ARGS+=	--enable-sjavac
-.endif
-
 # PR193009: work around the rtld bug
 .if ${OSVERSION} < 1001511
 CONFIGURE_ARGS+=	--enable-static-libjli

Modified: branches/2016Q1/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp
==============================================================================
--- branches/2016Q1/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp	Wed Jan 13 17:49:31 2016	(r406063)
+++ branches/2016Q1/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp	Wed Jan 13 18:13:57 2016	(r406064)
@@ -1,4 +1,4 @@
---- hotspot/src/os/bsd/vm/os_bsd.cpp.orig	2015-12-22 22:54:16 UTC
+--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig	2016-01-05 21:15:40 UTC
 +++ hotspot/src/os/bsd/vm/os_bsd.cpp
 @@ -151,6 +151,7 @@ mach_timebase_info_data_t os::Bsd::_time
  volatile uint64_t         os::Bsd::_max_abstime   = 0;
@@ -8,7 +8,21 @@
  #endif
  pthread_t os::Bsd::_main_thread;
  int os::Bsd::_page_size = -1;
-@@ -1058,6 +1059,7 @@ void os::Bsd::clock_init() {
+@@ -1028,6 +1029,13 @@ bool os::enable_vtime()   { return false
+ bool os::vtime_enabled()  { return false; }
+ 
+ double os::elapsedVTime() {
++#ifdef RUSAGE_THREAD
++  struct rusage usage;
++  int retval = getrusage(RUSAGE_THREAD, &usage);
++  if (retval == 0) {
++    return (double) (usage.ru_utime.tv_sec + usage.ru_stime.tv_sec) + (double) (usage.ru_utime.tv_usec + usage.ru_stime.tv_usec) / (1000 * 1000);
++  }
++#endif
+   // better than nothing, but not much
+   return elapsedTime();
+ }
+@@ -1058,6 +1066,7 @@ void os::Bsd::clock_init() {
      // yes, monotonic clock is supported
      _clock_gettime = ::clock_gettime;
    }
@@ -16,37 +30,48 @@
  }
  #endif
  
-@@ -4248,6 +4250,8 @@ jlong os::current_thread_cpu_time() {
+@@ -4248,8 +4257,9 @@ jlong os::current_thread_cpu_time() {
  #ifdef __APPLE__
    return os::thread_cpu_time(Thread::current(), true /* user + sys */);
  #else
+-  Unimplemented();
+-  return 0;
 +  if (Bsd::_getcpuclockid != NULL)
 +    return os::thread_cpu_time(Thread::current(), true /* user + sys */);
-   Unimplemented();
-   return 0;
++  return -1;
  #endif
-@@ -4257,6 +4261,8 @@ jlong os::thread_cpu_time(Thread* thread
+ }
+ 
+@@ -4257,8 +4267,9 @@ jlong os::thread_cpu_time(Thread* thread
  #ifdef __APPLE__
    return os::thread_cpu_time(thread, true /* user + sys */);
  #else
+-  Unimplemented();
+-  return 0;
 +  if (Bsd::_getcpuclockid != NULL)
 +    return os::thread_cpu_time(thread, true /* user + sys */);
-   Unimplemented();
-   return 0;
++  return -1;
  #endif
-@@ -4266,6 +4272,8 @@ jlong os::current_thread_cpu_time(bool u
+ }
+ 
+@@ -4266,8 +4277,9 @@ jlong os::current_thread_cpu_time(bool u
  #ifdef __APPLE__
    return os::thread_cpu_time(Thread::current(), user_sys_cpu_time);
  #else
+-  Unimplemented();
+-  return 0;
 +  if (Bsd::_getcpuclockid != NULL)
 +    return os::thread_cpu_time(Thread::current(), user_sys_cpu_time);
-   Unimplemented();
-   return 0;
++  return -1;
  #endif
-@@ -4292,6 +4300,24 @@ jlong os::thread_cpu_time(Thread *thread
+ }
+ 
+@@ -4292,8 +4304,41 @@ jlong os::thread_cpu_time(Thread *thread
      return ((jlong)tinfo.user_time.seconds * 1000000000) + ((jlong)tinfo.user_time.microseconds * (jlong)1000);
    }
  #else
+-  Unimplemented();
+-  return 0;
 +  if (user_sys_cpu_time && Bsd::_getcpuclockid != NULL) {
 +    struct timespec tp;
 +    clockid_t clockid;
@@ -65,10 +90,27 @@
 +      return -1;
 +    return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec;
 +  }
-   Unimplemented();
-   return 0;
++#ifdef RUSAGE_THREAD
++  if (thread == Thread::current()) {
++    struct rusage usage;
++    jlong nanos;
++
++    if (getrusage(RUSAGE_THREAD, &usage) != 0)
++      return -1;
++    nanos = (jlong)usage.ru_utime.tv_sec * NANOSECS_PER_SEC;
++    nanos += (jlong)usage.ru_utime.tv_usec * 1000;
++    if (user_sys_cpu_time) {
++      nanos += (jlong)usage.ru_stime.tv_sec * NANOSECS_PER_SEC;
++      nanos += (jlong)usage.ru_stime.tv_usec * 1000;
++    }
++    return nanos;
++  }
++#endif
++  return -1;
  #endif
-@@ -4316,7 +4342,7 @@ bool os::is_thread_cpu_time_supported() 
+ }
+ 
+@@ -4316,7 +4361,7 @@ bool os::is_thread_cpu_time_supported() 
  #ifdef __APPLE__
    return true;
  #else

Copied: branches/2016Q1/java/openjdk8/files/patch-jdk-src-solaris-native-sun-management-BsdOperatingSystem.c (from r405058, head/java/openjdk8/files/patch-jdk-src-solaris-native-sun-management-BsdOperatingSystem.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2016Q1/java/openjdk8/files/patch-jdk-src-solaris-native-sun-management-BsdOperatingSystem.c	Wed Jan 13 18:13:57 2016	(r406064, copy of r405058, head/java/openjdk8/files/patch-jdk-src-solaris-native-sun-management-BsdOperatingSystem.c)
@@ -0,0 +1,45 @@
+--- /dev/null	2016-01-01 15:03:12.000000000 -0800
++++ jdk/src/solaris/native/sun/management/BsdOperatingSystem.c	2016-01-01 15:01:40.593188000 -0800
+@@ -0,0 +1,42 @@
++/*
++ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.  Oracle designates this
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
++ * or visit www.oracle.com if you need additional information or have any
++ * questions.
++ */
++
++#include <jni.h>
++#include "jvm.h"
++#include "sun_management_OperatingSystemImpl.h"
++
++JNIEXPORT jdouble JNICALL
++Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
++(JNIEnv *env, jobject dummy)
++{
++    return (jdouble) -1;
++}
++
++JNIEXPORT jdouble JNICALL
++Java_sun_management_OperatingSystemImpl_getProcessCpuLoad
++(JNIEnv *env, jobject dummy)
++{
++    return (jdouble) -1;
++}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601131813.u0DIDvpn055529>