Merge

Fri, 15 Feb 2013 10:29:23 -0800

author
dsamersoff
date
Fri, 15 Feb 2013 10:29:23 -0800
changeset 4605
dc1de5e78a85
parent 4593
1cdf241a4b26
parent 4604
f35f1fbab3e1
child 4606
f82bcc429e8c

Merge

     1.1 --- a/agent/src/os/bsd/MacosxDebuggerLocal.m	Thu Feb 14 05:36:59 2013 -0800
     1.2 +++ b/agent/src/os/bsd/MacosxDebuggerLocal.m	Fri Feb 15 10:29:23 2013 -0800
     1.3 @@ -38,6 +38,8 @@
     1.4  #import <dlfcn.h>
     1.5  #import <limits.h>
     1.6  #import <errno.h>
     1.7 +#import <sys/types.h>
     1.8 +#import <sys/ptrace.h>
     1.9  
    1.10  jboolean debug = JNI_FALSE;
    1.11  
    1.12 @@ -430,6 +432,73 @@
    1.13    return (jint) usable_tid;
    1.14  }
    1.15  
    1.16 +
    1.17 +static bool ptrace_continue(pid_t pid, int signal) {
    1.18 +  // pass the signal to the process so we don't swallow it
    1.19 +  int res;
    1.20 +  if ((res = ptrace(PT_CONTINUE, pid, (caddr_t)1, signal)) < 0) {
    1.21 +    fprintf(stderr, "attach: ptrace(PT_CONTINUE, %d) failed with %d\n", pid, res);
    1.22 +    return false;
    1.23 +  }
    1.24 +  return true;
    1.25 +}
    1.26 +
    1.27 +// waits until the ATTACH has stopped the process
    1.28 +// by signal SIGSTOP
    1.29 +static bool ptrace_waitpid(pid_t pid) {
    1.30 +  int ret;
    1.31 +  int status;
    1.32 +  while (true) {
    1.33 +    // Wait for debuggee to stop.
    1.34 +    ret = waitpid(pid, &status, 0);
    1.35 +    if (ret >= 0) {
    1.36 +      if (WIFSTOPPED(status)) {
    1.37 +        // Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP
    1.38 +        // will still be pending and delivered when the process is DETACHED and the process
    1.39 +        // will go to sleep.
    1.40 +        if (WSTOPSIG(status) == SIGSTOP) {
    1.41 +          // Debuggee stopped by SIGSTOP.
    1.42 +          return true;
    1.43 +        }
    1.44 +        if (!ptrace_continue(pid, WSTOPSIG(status))) {
    1.45 +          fprintf(stderr, "attach: Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status));
    1.46 +          return false;
    1.47 +        }
    1.48 +      } else {
    1.49 +        fprintf(stderr, "attach: waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
    1.50 +        return false;
    1.51 +      }
    1.52 +    } else {
    1.53 +      switch (errno) {
    1.54 +        case EINTR:
    1.55 +          continue;
    1.56 +          break;
    1.57 +        case ECHILD:
    1.58 +          fprintf(stderr, "attach: waitpid() failed. Child process pid (%d) does not exist \n", pid);
    1.59 +          break;
    1.60 +        case EINVAL:
    1.61 +          fprintf(stderr, "attach: waitpid() failed. Invalid options argument.\n");
    1.62 +          break;
    1.63 +        default:
    1.64 +          fprintf(stderr, "attach: waitpid() failed. Unexpected error %d\n",errno);
    1.65 +          break;
    1.66 +      }
    1.67 +      return false;
    1.68 +    }
    1.69 +  }
    1.70 +}
    1.71 +
    1.72 +// attach to a process/thread specified by "pid"
    1.73 +static bool ptrace_attach(pid_t pid) {
    1.74 +  int res;
    1.75 +  if ((res = ptrace(PT_ATTACH, pid, 0, 0)) < 0) {
    1.76 +    fprintf(stderr, "ptrace(PT_ATTACH, %d) failed with %d\n", pid, res);
    1.77 +    return false;
    1.78 +  } else {
    1.79 +    return ptrace_waitpid(pid);
    1.80 +  }
    1.81 +}
    1.82 +
    1.83  /*
    1.84   * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
    1.85   * Method:    attach0
    1.86 @@ -445,7 +514,8 @@
    1.87    else
    1.88      debug = JNI_FALSE;
    1.89    if (debug) printf("attach0 called for jpid=%d\n", (int)jpid);
    1.90 -
    1.91 +  
    1.92 +  // get the task from the pid
    1.93    kern_return_t result;
    1.94    task_t gTask = 0;
    1.95    result = task_for_pid(mach_task_self(), jpid, &gTask);
    1.96 @@ -455,6 +525,13 @@
    1.97    }
    1.98    putTask(env, this_obj, gTask);
    1.99  
   1.100 +  // use ptrace to stop the process
   1.101 +  // on os x, ptrace only needs to be called on the process, not the individual threads
   1.102 +  if (ptrace_attach(jpid) != true) {
   1.103 +    mach_port_deallocate(mach_task_self(), gTask);
   1.104 +    THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
   1.105 +  }
   1.106 +
   1.107    id symbolicator = nil;
   1.108    id jrsSymbolicator = objc_lookUpClass("JRSSymbolicator");
   1.109    if (jrsSymbolicator != nil) {
   1.110 @@ -486,6 +563,21 @@
   1.111    if (debug) printf("detach0 called\n");
   1.112  
   1.113    task_t gTask = getTask(env, this_obj);
   1.114 +
   1.115 +  // detach from the ptraced process causing it to resume execution
   1.116 +  int pid;
   1.117 +  kern_return_t k_res;
   1.118 +  k_res = pid_for_task(gTask, &pid);
   1.119 +  if (k_res != KERN_SUCCESS) {
   1.120 +    fprintf(stderr, "detach: pid_for_task(%d) failed (%d)\n", pid, k_res);
   1.121 +  }
   1.122 +  else {
   1.123 +    int res = ptrace(PT_DETACH, pid, 0, 0);
   1.124 +    if (res < 0) {
   1.125 +      fprintf(stderr, "detach: ptrace(PT_DETACH, %d) failed (%d)\n", pid, res);
   1.126 +    }
   1.127 +  }
   1.128 +  
   1.129    mach_port_deallocate(mach_task_self(), gTask);
   1.130    id symbolicator = getSymbolicator(env, this_obj);
   1.131    if (symbolicator != nil) {
     2.1 --- a/agent/src/os/bsd/libproc_impl.c	Thu Feb 14 05:36:59 2013 -0800
     2.2 +++ b/agent/src/os/bsd/libproc_impl.c	Fri Feb 15 10:29:23 2013 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -91,6 +91,14 @@
    2.11     }
    2.12  }
    2.13  
    2.14 +void print_error(const char* format,...) {
    2.15 +  va_list alist;
    2.16 +  va_start(alist, format);
    2.17 +  fputs("ERROR: ", stderr);
    2.18 +  vfprintf(stderr, format, alist);
    2.19 +  va_end(alist);
    2.20 +}
    2.21 +
    2.22  bool is_debug() {
    2.23     return _libsaproc_debug;
    2.24  }
     3.1 --- a/agent/src/os/bsd/libproc_impl.h	Thu Feb 14 05:36:59 2013 -0800
     3.2 +++ b/agent/src/os/bsd/libproc_impl.h	Fri Feb 15 10:29:23 2013 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -107,6 +107,7 @@
    3.11  int pathmap_open(const char* name);
    3.12  
    3.13  void print_debug(const char* format,...);
    3.14 +void print_error(const char* format,...);
    3.15  bool is_debug();
    3.16  
    3.17  typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
     4.1 --- a/agent/src/os/bsd/ps_proc.c	Thu Feb 14 05:36:59 2013 -0800
     4.2 +++ b/agent/src/os/bsd/ps_proc.c	Fri Feb 15 10:29:23 2013 -0800
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -129,42 +129,66 @@
    4.11    return (errno == 0)? true: false;
    4.12  }
    4.13  
    4.14 +static bool ptrace_continue(pid_t pid, int signal) {
    4.15 +  // pass the signal to the process so we don't swallow it
    4.16 +  if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
    4.17 +    print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
    4.18 +    return false;
    4.19 +  }
    4.20 +  return true;
    4.21 +}
    4.22 +
    4.23 +// waits until the ATTACH has stopped the process
    4.24 +// by signal SIGSTOP
    4.25 +static bool ptrace_waitpid(pid_t pid) {
    4.26 +  int ret;
    4.27 +  int status;
    4.28 +  do {
    4.29 +    // Wait for debuggee to stop.
    4.30 +    ret = waitpid(pid, &status, 0);
    4.31 +    if (ret >= 0) {
    4.32 +      if (WIFSTOPPED(status)) {
    4.33 +        // Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP
    4.34 +        // will still be pending and delivered when the process is DETACHED and the process
    4.35 +        // will go to sleep.
    4.36 +        if (WSTOPSIG(status) == SIGSTOP) {
    4.37 +          // Debuggee stopped by SIGSTOP.
    4.38 +          return true;
    4.39 +        }
    4.40 +        if (!ptrace_continue(pid, WSTOPSIG(status))) {
    4.41 +          print_error("Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status));
    4.42 +          return false;
    4.43 +        }
    4.44 +      } else {
    4.45 +        print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
    4.46 +        return false;
    4.47 +      }
    4.48 +    } else {
    4.49 +      switch (errno) {
    4.50 +        case EINTR:
    4.51 +          continue;
    4.52 +          break;
    4.53 +        case ECHILD:
    4.54 +          print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
    4.55 +          break;
    4.56 +        case EINVAL:
    4.57 +          print_debug("waitpid() failed. Invalid options argument.\n");
    4.58 +          break;
    4.59 +        default:
    4.60 +          print_debug("waitpid() failed. Unexpected error %d\n",errno);
    4.61 +      }
    4.62 +      return false;
    4.63 +    }
    4.64 +  } while(true);
    4.65 +}
    4.66 +
    4.67  // attach to a process/thread specified by "pid"
    4.68  static bool ptrace_attach(pid_t pid) {
    4.69    if (ptrace(PT_ATTACH, pid, NULL, 0) < 0) {
    4.70      print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
    4.71      return false;
    4.72    } else {
    4.73 -    int ret;
    4.74 -    int status;
    4.75 -    do {
    4.76 -      // Wait for debuggee to stop.
    4.77 -      ret = waitpid(pid, &status, 0);
    4.78 -      if (ret >= 0) {
    4.79 -        if (WIFSTOPPED(status)) {
    4.80 -          // Debuggee stopped.
    4.81 -          return true;
    4.82 -        } else {
    4.83 -          print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
    4.84 -          return false;
    4.85 -        }
    4.86 -      } else {
    4.87 -        switch (errno) {
    4.88 -          case EINTR:
    4.89 -            continue;
    4.90 -            break;
    4.91 -          case ECHILD:
    4.92 -            print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
    4.93 -            break;
    4.94 -          case EINVAL:
    4.95 -            print_debug("waitpid() failed. Invalid options argument.\n");
    4.96 -            break;
    4.97 -          default:
    4.98 -            print_debug("waitpid() failed. Unexpected error %d\n",errno);
    4.99 -        }
   4.100 -        return false;
   4.101 -      }
   4.102 -    } while(true);
   4.103 +    return ptrace_waitpid(pid);
   4.104    }
   4.105  }
   4.106  
     5.1 --- a/agent/src/os/linux/libproc_impl.c	Thu Feb 14 05:36:59 2013 -0800
     5.2 +++ b/agent/src/os/linux/libproc_impl.c	Fri Feb 15 10:29:23 2013 -0800
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -92,6 +92,14 @@
    5.11     }
    5.12  }
    5.13  
    5.14 +void print_error(const char* format,...) {
    5.15 +  va_list alist;
    5.16 +  va_start(alist, format);
    5.17 +  fputs("ERROR: ", stderr);
    5.18 +  vfprintf(stderr, format, alist);
    5.19 +  va_end(alist);
    5.20 +}
    5.21 +
    5.22  bool is_debug() {
    5.23     return _libsaproc_debug;
    5.24  }
     6.1 --- a/agent/src/os/linux/libproc_impl.h	Thu Feb 14 05:36:59 2013 -0800
     6.2 +++ b/agent/src/os/linux/libproc_impl.h	Fri Feb 15 10:29:23 2013 -0800
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -105,6 +105,7 @@
    6.11  int pathmap_open(const char* name);
    6.12  
    6.13  void print_debug(const char* format,...);
    6.14 +void print_error(const char* format,...);
    6.15  bool is_debug();
    6.16  
    6.17  typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
     7.1 --- a/agent/src/os/linux/ps_proc.c	Thu Feb 14 05:36:59 2013 -0800
     7.2 +++ b/agent/src/os/linux/ps_proc.c	Fri Feb 15 10:29:23 2013 -0800
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -25,6 +25,7 @@
    7.11  #include <stdio.h>
    7.12  #include <stdlib.h>
    7.13  #include <string.h>
    7.14 +#include <signal.h>
    7.15  #include <errno.h>
    7.16  #include <sys/ptrace.h>
    7.17  #include "libproc_impl.h"
    7.18 @@ -142,46 +143,71 @@
    7.19  
    7.20  }
    7.21  
    7.22 +static bool ptrace_continue(pid_t pid, int signal) {
    7.23 +  // pass the signal to the process so we don't swallow it
    7.24 +  if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
    7.25 +    print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
    7.26 +    return false;
    7.27 +  }
    7.28 +  return true;
    7.29 +}
    7.30 +
    7.31 +// waits until the ATTACH has stopped the process
    7.32 +// by signal SIGSTOP
    7.33 +static bool ptrace_waitpid(pid_t pid) {
    7.34 +  int ret;
    7.35 +  int status;
    7.36 +  while (true) {
    7.37 +    // Wait for debuggee to stop.
    7.38 +    ret = waitpid(pid, &status, 0);
    7.39 +    if (ret == -1 && errno == ECHILD) {
    7.40 +      // try cloned process.
    7.41 +      ret = waitpid(pid, &status, __WALL);
    7.42 +    }
    7.43 +    if (ret >= 0) {
    7.44 +      if (WIFSTOPPED(status)) {
    7.45 +        // Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP
    7.46 +        // will still be pending and delivered when the process is DETACHED and the process
    7.47 +        // will go to sleep.
    7.48 +        if (WSTOPSIG(status) == SIGSTOP) {
    7.49 +          // Debuggee stopped by SIGSTOP.
    7.50 +          return true;
    7.51 +        }
    7.52 +        if (!ptrace_continue(pid, WSTOPSIG(status))) {
    7.53 +          print_error("Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status));
    7.54 +          return false;
    7.55 +        }
    7.56 +      } else {
    7.57 +        print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
    7.58 +        return false;
    7.59 +      }
    7.60 +    } else {
    7.61 +      switch (errno) {
    7.62 +        case EINTR:
    7.63 +          continue;
    7.64 +          break;
    7.65 +        case ECHILD:
    7.66 +          print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
    7.67 +          break;
    7.68 +        case EINVAL:
    7.69 +          print_debug("waitpid() failed. Invalid options argument.\n");
    7.70 +          break;
    7.71 +        default:
    7.72 +          print_debug("waitpid() failed. Unexpected error %d\n",errno);
    7.73 +          break;
    7.74 +      }
    7.75 +      return false;
    7.76 +    }
    7.77 +  }
    7.78 +}
    7.79 +
    7.80  // attach to a process/thread specified by "pid"
    7.81  static bool ptrace_attach(pid_t pid) {
    7.82    if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) < 0) {
    7.83      print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
    7.84      return false;
    7.85    } else {
    7.86 -    int ret;
    7.87 -    int status;
    7.88 -    do {
    7.89 -      // Wait for debuggee to stop.
    7.90 -      ret = waitpid(pid, &status, 0);
    7.91 -      if (ret == -1 && errno == ECHILD) {
    7.92 -        // try cloned process.
    7.93 -        ret = waitpid(pid, &status, __WALL);
    7.94 -      }
    7.95 -      if (ret >= 0) {
    7.96 -        if (WIFSTOPPED(status)) {
    7.97 -          // Debuggee stopped.
    7.98 -          return true;
    7.99 -        } else {
   7.100 -          print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
   7.101 -          return false;
   7.102 -        }
   7.103 -      } else {
   7.104 -        switch (errno) {
   7.105 -          case EINTR:
   7.106 -            continue;
   7.107 -            break;
   7.108 -          case ECHILD:
   7.109 -            print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
   7.110 -            break;
   7.111 -          case EINVAL:
   7.112 -            print_debug("waitpid() failed. Invalid options argument.\n");
   7.113 -            break;
   7.114 -          default:
   7.115 -            print_debug("waitpid() failed. Unexpected error %d\n",errno);
   7.116 -        }
   7.117 -        return false;
   7.118 -      }
   7.119 -    } while(true);
   7.120 +    return ptrace_waitpid(pid);
   7.121    }
   7.122  }
   7.123  
     8.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java	Thu Feb 14 05:36:59 2013 -0800
     8.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java	Fri Feb 15 10:29:23 2013 -0800
     8.3 @@ -61,15 +61,13 @@
     8.4      CMSBitMap markBitMap = markBitMap();
     8.5      long addressSize = VM.getVM().getAddressSize();
     8.6      if ( markBitMap.isMarked(addr) &&  markBitMap.isMarked(addr.addOffsetTo(1*addressSize)) ) {
     8.7 -       System.err.println("Printezis bits are set...");
     8.8        Address nextOneAddr = markBitMap.getNextMarkedWordAddress(addr.addOffsetTo(2*addressSize));
     8.9        //return size in bytes
    8.10        long size =  (nextOneAddr.addOffsetTo(1*addressSize)).minus(addr);
    8.11        return size;
    8.12      } else {
    8.13 -     //missing Printezis marks
    8.14 -     System.err.println("Missing Printszis marks...");
    8.15 -     return -1;
    8.16 +      //missing Printezis marks
    8.17 +      return -1;
    8.18      }
    8.19  
    8.20    }
     9.1 --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java	Thu Feb 14 05:36:59 2013 -0800
     9.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java	Fri Feb 15 10:29:23 2013 -0800
     9.3 @@ -191,7 +191,6 @@
     9.4              //Find the object size using Printezis bits and skip over
     9.5              long size = collector().blockSizeUsingPrintezisBits(cur);
     9.6              if (size == -1) {
     9.7 -              System.err.println("Printezis bits not set...");
     9.8                break;
     9.9              }
    9.10              cur = cur.addOffsetTo(adjustObjectSizeInBytes(size));
    10.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java	Thu Feb 14 05:36:59 2013 -0800
    10.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java	Fri Feb 15 10:29:23 2013 -0800
    10.3 @@ -184,7 +184,6 @@
    10.4        if (trapReasonName[index] == null) {
    10.5          throw new InternalError("missing reason for " + index);
    10.6        }
    10.7 -      System.out.println(trapReasonName[index]);
    10.8      }
    10.9    }
   10.10  
    11.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Thu Feb 14 05:36:59 2013 -0800
    11.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Fri Feb 15 10:29:23 2013 -0800
    11.3 @@ -335,7 +335,6 @@
    11.4            }
    11.5            if (obj == null) {
    11.6               //Find the object size using Printezis bits and skip over
    11.7 -             System.err.println("Finding object size using Printezis bits and skipping over...");
    11.8               long size = 0;
    11.9  
   11.10               if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ){
    12.1 --- a/make/bsd/makefiles/vm.make	Thu Feb 14 05:36:59 2013 -0800
    12.2 +++ b/make/bsd/makefiles/vm.make	Fri Feb 15 10:29:23 2013 -0800
    12.3 @@ -94,7 +94,12 @@
    12.4  # This is VERY important! The version define must only be supplied to vm_version.o
    12.5  # If not, ccache will not re-use the cache at all, since the version string might contain
    12.6  # a time and date. 
    12.7 -vm_version.o: CXXFLAGS += ${JRE_VERSION} 
    12.8 +CXXFLAGS/vm_version.o += ${JRE_VERSION}
    12.9 +
   12.10 +CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
   12.11 +
   12.12 +# File specific flags
   12.13 +CXXFLAGS += $(CXXFLAGS/BYFILE)
   12.14  
   12.15  ifdef DEFAULT_LIBPATH
   12.16  CXXFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
    13.1 --- a/make/linux/makefiles/vm.make	Thu Feb 14 05:36:59 2013 -0800
    13.2 +++ b/make/linux/makefiles/vm.make	Fri Feb 15 10:29:23 2013 -0800
    13.3 @@ -100,7 +100,13 @@
    13.4  # This is VERY important! The version define must only be supplied to vm_version.o
    13.5  # If not, ccache will not re-use the cache at all, since the version string might contain
    13.6  # a time and date. 
    13.7 -vm_version.o: CXXFLAGS += ${JRE_VERSION}
    13.8 +CXXFLAGS/vm_version.o += ${JRE_VERSION}
    13.9 +
   13.10 +CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
   13.11 +
   13.12 +# File specific flags
   13.13 +CXXFLAGS += $(CXXFLAGS/BYFILE)
   13.14 +
   13.15  
   13.16  ifndef JAVASE_EMBEDDED 
   13.17  ifneq (${ARCH},arm)
    14.1 --- a/make/solaris/makefiles/vm.make	Thu Feb 14 05:36:59 2013 -0800
    14.2 +++ b/make/solaris/makefiles/vm.make	Fri Feb 15 10:29:23 2013 -0800
    14.3 @@ -88,7 +88,13 @@
    14.4  # This is VERY important! The version define must only be supplied to vm_version.o
    14.5  # If not, ccache will not re-use the cache at all, since the version string might contain
    14.6  # a time and date. 
    14.7 -vm_version.o: CXXFLAGS += ${JRE_VERSION} 
    14.8 +CXXFLAGS/vm_version.o += ${JRE_VERSION}
    14.9 +
   14.10 +CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
   14.11 +
   14.12 +# File specific flags
   14.13 +CXXFLAGS += $(CXXFLAGS/BYFILE)
   14.14 +
   14.15  
   14.16  # CFLAGS_WARN holds compiler options to suppress/enable warnings.
   14.17  CFLAGS += $(CFLAGS_WARN)
    15.1 --- a/src/os/windows/vm/os_windows.cpp	Thu Feb 14 05:36:59 2013 -0800
    15.2 +++ b/src/os/windows/vm/os_windows.cpp	Fri Feb 15 10:29:23 2013 -0800
    15.3 @@ -1940,7 +1940,7 @@
    15.4  
    15.5  // a counter for each possible signal value, including signal_thread exit signal
    15.6  static volatile jint pending_signals[NSIG+1] = { 0 };
    15.7 -static HANDLE sig_sem;
    15.8 +static HANDLE sig_sem = NULL;
    15.9  
   15.10  void os::signal_init_pd() {
   15.11    // Initialize signal structures
   15.12 @@ -1970,10 +1970,11 @@
   15.13  
   15.14  void os::signal_notify(int signal_number) {
   15.15    BOOL ret;
   15.16 -
   15.17 -  Atomic::inc(&pending_signals[signal_number]);
   15.18 -  ret = ::ReleaseSemaphore(sig_sem, 1, NULL);
   15.19 -  assert(ret != 0, "ReleaseSemaphore() failed");
   15.20 +  if (sig_sem != NULL) {
   15.21 +    Atomic::inc(&pending_signals[signal_number]);
   15.22 +    ret = ::ReleaseSemaphore(sig_sem, 1, NULL);
   15.23 +    assert(ret != 0, "ReleaseSemaphore() failed");
   15.24 +  }
   15.25  }
   15.26  
   15.27  static int check_pending_signals(bool wait_for_signal) {
    16.1 --- a/src/share/vm/classfile/verifier.cpp	Thu Feb 14 05:36:59 2013 -0800
    16.2 +++ b/src/share/vm/classfile/verifier.cpp	Fri Feb 15 10:29:23 2013 -0800
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -61,7 +61,8 @@
   16.11  # include "bytes_ppc.hpp"
   16.12  #endif
   16.13  
   16.14 -#define NOFAILOVER_MAJOR_VERSION 51
   16.15 +#define NOFAILOVER_MAJOR_VERSION                  51
   16.16 +#define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION  52
   16.17  
   16.18  // Access to external entry for VerifyClassCodes - old byte code verifier
   16.19  
   16.20 @@ -2317,6 +2318,11 @@
   16.21        types = (1 << JVM_CONSTANT_InterfaceMethodref) |
   16.22                (1 << JVM_CONSTANT_Methodref);
   16.23        break;
   16.24 +    case Bytecodes::_invokestatic:
   16.25 +      types = (_klass->major_version() < STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION) ?
   16.26 +        (1 << JVM_CONSTANT_Methodref) :
   16.27 +        ((1 << JVM_CONSTANT_InterfaceMethodref) | (1 << JVM_CONSTANT_Methodref));
   16.28 +      break;
   16.29      default:
   16.30        types = 1 << JVM_CONSTANT_Methodref;
   16.31    }
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/test/runtime/8007736/TestStaticIF.java	Fri Feb 15 10:29:23 2013 -0800
    17.3 @@ -0,0 +1,44 @@
    17.4 +/*
    17.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 + *
    17.8 + * This code is free software; you can redistribute it and/or modify it
    17.9 + * under the terms of the GNU General Public License version 2 only, as
   17.10 + * published by the Free Software Foundation.
   17.11 + *
   17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.15 + * version 2 for more details (a copy is included in the LICENSE file that
   17.16 + * accompanied this code).
   17.17 + *
   17.18 + * You should have received a copy of the GNU General Public License version
   17.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.21 + *
   17.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.23 + * or visit www.oracle.com if you need additional information or have any
   17.24 + * questions.
   17.25 + *
   17.26 + */
   17.27 +
   17.28 +/*
   17.29 + * @test
   17.30 + * @bug 8007736
   17.31 + * @summary Test static interface method.
   17.32 + * @run main/othervm -Xverify:all TestStaticIF
   17.33 + */
   17.34 +
   17.35 +public class TestStaticIF implements StaticMethodInInterface {
   17.36 +
   17.37 +    public static void main(String[] args) {
   17.38 +        System.out.printf("main: %s%n", StaticMethodInInterface.get());
   17.39 +    }
   17.40 +}
   17.41 +
   17.42 +interface StaticMethodInInterface {
   17.43 +
   17.44 +    public static String get() {
   17.45 +        return "Hello from StaticMethodInInterface.get()";
   17.46 +    }
   17.47 +}

mercurial