# HG changeset patch # User Andrew John Hughes # Date 1363033148 0 # Node ID 3b31da62583f985414c51933df55d9017c0fe540 # Parent ac2e6d3acc008a80168aaa56dc2cd03d219af51f Revert 7017193 and add the missing free call on a -1 return, until a better fix is ready. http://mail.openjdk.java.net/pipermail/hotspot-dev/2013-February/008695.html 2013-03-11 Andrew John Hughes * Makefile.am: (ICEDTEA_PATCHES): Add new patch. * patches/revert-7017193.patch: Revert 7017193 due to performance issues, adding a free call on error, until a better fix is produced. * NEWS: Updated. diff -r ac2e6d3acc00 -r 3b31da62583f ChangeLog --- a/ChangeLog Mon Mar 11 16:30:36 2013 +0000 +++ b/ChangeLog Mon Mar 11 20:19:08 2013 +0000 @@ -1,3 +1,13 @@ +2013-03-11 Andrew John Hughes + + * Makefile.am: + (ICEDTEA_PATCHES): Add new patch. + * patches/revert-7017193.patch: + Revert 7017193 due to performance issues, + adding a free call on error, until a better + fix is produced. + * NEWS: Updated. + 2013-03-11 Andrew John Hughes PR1340: Simplify the rewriter, avoiding concurrency. diff -r ac2e6d3acc00 -r 3b31da62583f Makefile.am --- a/Makefile.am Mon Mar 11 16:30:36 2013 +0000 +++ b/Makefile.am Mon Mar 11 20:19:08 2013 +0000 @@ -241,7 +241,8 @@ patches/8006179-lookup_using_findvirtual.patch \ patches/8006882-sun.proxy.patch \ patches/pr1303-ifdef_fix.patch \ - patches/no_stripping.patch + patches/no_stripping.patch \ + patches/revert-7017193.patch # Conditional patches diff -r ac2e6d3acc00 -r 3b31da62583f NEWS --- a/NEWS Mon Mar 11 16:30:36 2013 +0000 +++ b/NEWS Mon Mar 11 20:19:08 2013 +0000 @@ -24,6 +24,7 @@ - PR1303: Correct #ifdef to #if - Stop libraries being stripped in the OpenJDK build. - PR1340: Simplify the rhino class rewriter to avoid use of concurrency + - Revert 7017193 and add the missing free call, until a better fix is ready. New in release 2.1.6 (2013-02-20): diff -r ac2e6d3acc00 -r 3b31da62583f patches/revert-7017193.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/revert-7017193.patch Mon Mar 11 20:19:08 2013 +0000 @@ -0,0 +1,136 @@ +diff -Nru openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp openjdk/hotspot/src/os/linux/vm/os_linux.cpp +--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp 2013-02-15 00:04:42.000000000 +0000 ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp 2013-03-11 20:15:01.080257099 +0000 +@@ -2788,39 +2788,47 @@ + // writing thread stacks don't use growable mappings (i.e. those + // creeated with MAP_GROWSDOWN), and aren't marked "[stack]", so this + // only applies to the main thread. +- +-static +-bool get_stack_bounds(uintptr_t *bottom, uintptr_t *top) { +- +- char buf[128]; +- int fd, sz; +- +- if ((fd = ::open("/proc/self/maps", O_RDONLY)) < 0) { ++static bool ++get_stack_bounds(uintptr_t *bottom, uintptr_t *top) ++{ ++ FILE *f = fopen("/proc/self/maps", "r"); ++ if (f == NULL) + return false; +- } + +- const char kw[] = "[stack]"; +- const int kwlen = sizeof(kw)-1; +- +- // Address part of /proc/self/maps couldn't be more than 128 bytes +- while ((sz = os::get_line_chars(fd, buf, sizeof(buf))) > 0) { +- if (sz > kwlen && ::memcmp(buf+sz-kwlen, kw, kwlen) == 0) { +- // Extract addresses +- if (sscanf(buf, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) { +- uintptr_t sp = (uintptr_t) __builtin_frame_address(0); +- if (sp >= *bottom && sp <= *top) { +- ::close(fd); +- return true; +- } ++ while (!feof(f)) { ++ size_t dummy; ++ char *str = NULL; ++ ssize_t len = getline(&str, &dummy, f); ++ if (len == -1) { ++ fclose(f); ++ if (str != NULL) ++ free(str); ++ return false; ++ } ++ ++ if (len > 0 && str[len-1] == '\n') { ++ str[len-1] = 0; ++ len--; ++ } ++ ++ static const char *stack_str = "[stack]"; ++ if (len > (ssize_t)strlen(stack_str) ++ && (strcmp(str + len - strlen(stack_str), stack_str) == 0)) { ++ if (sscanf(str, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) { ++ uintptr_t sp = (uintptr_t)__builtin_frame_address(0); ++ if (sp >= *bottom && sp <= *top) { ++ free(str); ++ fclose(f); ++ return true; + } +- } ++ } ++ } ++ free(str); + } +- +- ::close(fd); ++ fclose(f); + return false; + } + +- + // If the (growable) stack mapping already extends beyond the point + // where we're going to put our guard pages, truncate the mapping at + // that point by munmap()ping it. This ensures that when we later +diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/os.cpp openjdk/hotspot/src/share/vm/runtime/os.cpp +--- openjdk.orig/hotspot/src/share/vm/runtime/os.cpp 2013-02-15 00:04:42.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/runtime/os.cpp 2013-03-11 20:15:01.080257099 +0000 +@@ -1306,41 +1306,3 @@ + } + return result; + } +- +-// Read file line by line, if line is longer than bsize, +-// skip rest of line. +-int os::get_line_chars(int fd, char* buf, const size_t bsize){ +- size_t sz, i = 0; +- +- // read until EOF, EOL or buf is full +- while ((sz = (int) read(fd, &buf[i], 1)) == 1 && i < (bsize-2) && buf[i] != '\n') { +- ++i; +- } +- +- if (buf[i] == '\n') { +- // EOL reached so ignore EOL character and return +- +- buf[i] = 0; +- return (int) i; +- } +- +- buf[i+1] = 0; +- +- if (sz != 1) { +- // EOF reached. if we read chars before EOF return them and +- // return EOF on next call otherwise return EOF +- +- return (i == 0) ? -1 : (int) i; +- } +- +- // line is longer than size of buf, skip to EOL +- char ch; +- while (read(fd, &ch, 1) == 1 && ch != '\n') { +- // Do nothing +- } +- +- // return initial part of line that fits in buf. +- // If we reached EOF, it will be returned on next call. +- +- return (int) i; +-} +diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/os.hpp openjdk/hotspot/src/share/vm/runtime/os.hpp +--- openjdk.orig/hotspot/src/share/vm/runtime/os.hpp 2013-02-15 00:04:42.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/runtime/os.hpp 2013-03-11 20:15:16.008497745 +0000 +@@ -661,10 +661,6 @@ + // Hook for os specific jvm options that we don't want to abort on seeing + static bool obsolete_option(const JavaVMOption *option); + +- // Read file line by line. If line is longer than bsize, +- // rest of line is skipped. Returns number of bytes read or -1 on EOF +- static int get_line_chars(int fd, char *buf, const size_t bsize); +- + // Platform dependent stuff + #ifdef TARGET_OS_FAMILY_linux + # include "os_linux.hpp"