comparison src/os/linux/vm/os_linux.hpp @ 8675:63e54c37ac64

8008959: Fix non-PCH build on Linux, Windows and MacOS X Summary: Fix the build without precompiled headers by either including the missing ".inline.hpp" files into the appropriate files or by turning inline-functions declared in header files into ordinary functions in ".cpp" files. Reviewed-by: coleenp, stefank, dholmes
author simonis
date Wed, 27 Feb 2013 09:40:30 +0100
parents fa9253dcd4df
children 9058789475af
comparison
equal deleted inserted replaced
8105:94478a033036 8675:63e54c37ac64
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.
207 // Linux suspend/resume support - this helper is a shadow of its former 207 // 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 208 // self now that low-level suspension is barely used, and old workarounds
209 // for LinuxThreads are no longer needed. 209 // for LinuxThreads are no longer needed.
210 class SuspendResume { 210 class SuspendResume {
211 private: 211 private:
212 volatile int _suspend_action; 212 volatile int _suspend_action;
213 volatile jint _state;
214 public:
213 // values for suspend_action: 215 // values for suspend_action:
214 #define SR_NONE (0x00) 216 enum {
215 #define SR_SUSPEND (0x01) // suspend request 217 SR_NONE = 0x00,
216 #define SR_CONTINUE (0x02) // resume request 218 SR_SUSPEND = 0x01, // suspend request
217 219 SR_CONTINUE = 0x02, // resume request
218 volatile jint _state; 220 SR_SUSPENDED = 0x20 // values for _state: + SR_NONE
219 // values for _state: + SR_NONE 221 };
220 #define SR_SUSPENDED (0x20) 222
221 public:
222 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; } 223 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; }
223 224
224 int suspend_action() const { return _suspend_action; } 225 int suspend_action() const { return _suspend_action; }
225 void set_suspend_action(int x) { _suspend_action = x; } 226 void set_suspend_action(int x) { _suspend_action = x; }
226 227
227 // atomic updates for _state 228 // atomic updates for _state
228 void set_suspended() { 229 inline void set_suspended();
229 jint temp, temp2; 230 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; } 231 bool is_suspended() { return _state & SR_SUSPENDED; }
243 232
244 #undef SR_SUSPENDED
245 }; 233 };
246 234
247 private: 235 private:
248 typedef int (*sched_getcpu_func_t)(void); 236 typedef int (*sched_getcpu_func_t)(void);
249 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); 237 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);