src/share/vm/runtime/os.cpp

changeset 6472
2b8e28fdf503
parent 6462
e2722a66aba7
parent 5721
179cd89fb279
child 6506
f040cf9fc9c0
     1.1 --- a/src/share/vm/runtime/os.cpp	Wed Oct 16 10:52:41 2013 +0200
     1.2 +++ b/src/share/vm/runtime/os.cpp	Tue Nov 05 17:38:04 2013 -0800
     1.3 @@ -314,6 +314,11 @@
     1.4    }
     1.5  }
     1.6  
     1.7 +void os::init_before_ergo() {
     1.8 +  // We need to initialize large page support here because ergonomics takes some
     1.9 +  // decisions depending on large page support and the calculated large page size.
    1.10 +  large_page_init();
    1.11 +}
    1.12  
    1.13  void os::signal_init() {
    1.14    if (!ReduceSignalUsage) {
    1.15 @@ -454,6 +459,7 @@
    1.16   */
    1.17  void* os::find_agent_function(AgentLibrary *agent_lib, bool check_lib,
    1.18                                const char *syms[], size_t syms_len) {
    1.19 +  assert(agent_lib != NULL, "sanity check");
    1.20    const char *lib_name;
    1.21    void *handle = agent_lib->os_lib();
    1.22    void *entryName = NULL;
    1.23 @@ -484,6 +490,7 @@
    1.24    void *proc_handle;
    1.25    void *save_handle;
    1.26  
    1.27 +  assert(agent_lib != NULL, "sanity check");
    1.28    if (agent_lib->name() == NULL) {
    1.29      return false;
    1.30    }
    1.31 @@ -493,14 +500,13 @@
    1.32    // We want to look in this process' symbol table.
    1.33    agent_lib->set_os_lib(proc_handle);
    1.34    ret = find_agent_function(agent_lib, true, syms, syms_len);
    1.35 -  agent_lib->set_os_lib(save_handle);
    1.36    if (ret != NULL) {
    1.37      // Found an entry point like Agent_OnLoad_lib_name so we have a static agent
    1.38 -    agent_lib->set_os_lib(proc_handle);
    1.39      agent_lib->set_valid();
    1.40      agent_lib->set_static_lib(true);
    1.41      return true;
    1.42    }
    1.43 +  agent_lib->set_os_lib(save_handle);
    1.44    return false;
    1.45  }
    1.46  
    1.47 @@ -1485,44 +1491,6 @@
    1.48    return result;
    1.49  }
    1.50  
    1.51 -// Read file line by line, if line is longer than bsize,
    1.52 -// skip rest of line.
    1.53 -int os::get_line_chars(int fd, char* buf, const size_t bsize){
    1.54 -  size_t sz, i = 0;
    1.55 -
    1.56 -  // read until EOF, EOL or buf is full
    1.57 -  while ((sz = (int) read(fd, &buf[i], 1)) == 1 && i < (bsize-2) && buf[i] != '\n') {
    1.58 -     ++i;
    1.59 -  }
    1.60 -
    1.61 -  if (buf[i] == '\n') {
    1.62 -    // EOL reached so ignore EOL character and return
    1.63 -
    1.64 -    buf[i] = 0;
    1.65 -    return (int) i;
    1.66 -  }
    1.67 -
    1.68 -  buf[i+1] = 0;
    1.69 -
    1.70 -  if (sz != 1) {
    1.71 -    // EOF reached. if we read chars before EOF return them and
    1.72 -    // return EOF on next call otherwise return EOF
    1.73 -
    1.74 -    return (i == 0) ? -1 : (int) i;
    1.75 -  }
    1.76 -
    1.77 -  // line is longer than size of buf, skip to EOL
    1.78 -  char ch;
    1.79 -  while (read(fd, &ch, 1) == 1 && ch != '\n') {
    1.80 -    // Do nothing
    1.81 -  }
    1.82 -
    1.83 -  // return initial part of line that fits in buf.
    1.84 -  // If we reached EOF, it will be returned on next call.
    1.85 -
    1.86 -  return (int) i;
    1.87 -}
    1.88 -
    1.89  void os::SuspendedThreadTask::run() {
    1.90    assert(Threads_lock->owned_by_self() || (_thread == VMThread::vm_thread()), "must have threads lock to call this");
    1.91    internal_do_task();

mercurial