comparison src/os/linux/vm/os_linux.hpp @ 9212:216dce75d5ac

Merge.
author Christian Humer <christian.humer@gmail.com>
date Mon, 08 Apr 2013 17:02:55 +0200
parents 14509df4cd63
children b4081e9714ec
comparison
equal deleted inserted replaced
9211:77c17c97f713 9212:216dce75d5ac
1 /* 1 /*
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
92 static void print_full_memory_info(outputStream* st); 92 static void print_full_memory_info(outputStream* st);
93 static void print_distro_info(outputStream* st); 93 static void print_distro_info(outputStream* st);
94 static void print_libversion_info(outputStream* st); 94 static void print_libversion_info(outputStream* st);
95 95
96 public: 96 public:
97 static bool _stack_is_executable;
98 static void *dlopen_helper(const char *name, char *ebuf, int ebuflen);
99 static void *dll_load_in_vmthread(const char *name, char *ebuf, int ebuflen);
100
97 static void init_thread_fpu_state(); 101 static void init_thread_fpu_state();
98 static int get_fpu_control_word(); 102 static int get_fpu_control_word();
99 static void set_fpu_control_word(int fpu_control); 103 static void set_fpu_control_word(int fpu_control);
100 static pthread_t main_thread(void) { return _main_thread; } 104 static pthread_t main_thread(void) { return _main_thread; }
101 // returns kernel thread id (similar to LWP id on Solaris), which can be 105 // returns kernel thread id (similar to LWP id on Solaris), which can be
207 // Linux suspend/resume support - this helper is a shadow of its former 211 // Linux suspend/resume support - this helper is a shadow of its former
208 // self now that low-level suspension is barely used, and old workarounds 212 // self now that low-level suspension is barely used, and old workarounds
209 // for LinuxThreads are no longer needed. 213 // for LinuxThreads are no longer needed.
210 class SuspendResume { 214 class SuspendResume {
211 private: 215 private:
212 volatile int _suspend_action; 216 volatile int _suspend_action;
217 volatile jint _state;
218 public:
213 // values for suspend_action: 219 // values for suspend_action:
214 #define SR_NONE (0x00) 220 enum {
215 #define SR_SUSPEND (0x01) // suspend request 221 SR_NONE = 0x00,
216 #define SR_CONTINUE (0x02) // resume request 222 SR_SUSPEND = 0x01, // suspend request
217 223 SR_CONTINUE = 0x02, // resume request
218 volatile jint _state; 224 SR_SUSPENDED = 0x20 // values for _state: + SR_NONE
219 // values for _state: + SR_NONE 225 };
220 #define SR_SUSPENDED (0x20) 226
221 public:
222 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; } 227 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; }
223 228
224 int suspend_action() const { return _suspend_action; } 229 int suspend_action() const { return _suspend_action; }
225 void set_suspend_action(int x) { _suspend_action = x; } 230 void set_suspend_action(int x) { _suspend_action = x; }
226 231
227 // atomic updates for _state 232 // atomic updates for _state
228 void set_suspended() { 233 inline void set_suspended();
229 jint temp, temp2; 234 inline void clear_suspended();
230 do {
231 temp = _state;
232 temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp);
233 } while (temp2 != temp);
234 }
235 void clear_suspended() {
236 jint temp, temp2;
237 do {
238 temp = _state;
239 temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp);
240 } while (temp2 != temp);
241 }
242 bool is_suspended() { return _state & SR_SUSPENDED; } 235 bool is_suspended() { return _state & SR_SUSPENDED; }
243 236
244 #undef SR_SUSPENDED
245 }; 237 };
246 238
247 private: 239 private:
248 typedef int (*sched_getcpu_func_t)(void); 240 typedef int (*sched_getcpu_func_t)(void);
249 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); 241 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);