libreoffice: update to 24.8.4.2
[oi-userland.git] / components / runtime / openjdk-23 / patches / illumos-zero-2.patch
blobe46f662e0e453525376771321a3fd8c004844fd8
1 diff -ur -N /tmp/g/atomic_solaris_zero.hpp b/src/hotspot/os_cpu/solaris_zero/atomic_solaris_zero.hpp
2 --- /tmp/g/atomic_solaris_zero.hpp 1970-01-01 01:00:00.000000000 +0000
3 +++ b/src/hotspot/os_cpu/solaris_zero/atomic_solaris_zero.hpp 2020-08-27 09:48:36.864797068 +0000
4 @@ -0,0 +1,182 @@
5 +/*
6 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 + *
9 + * This code is free software; you can redistribute it and/or modify it
10 + * under the terms of the GNU General Public License version 2 only, as
11 + * published by the Free Software Foundation.
12 + *
13 + * This code is distributed in the hope that it will be useful, but WITHOUT
14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 + * version 2 for more details (a copy is included in the LICENSE file that
17 + * accompanied this code).
18 + *
19 + * You should have received a copy of the GNU General Public License version
20 + * 2 along with this work; if not, write to the Free Software Foundation,
21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 + *
23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
24 + * or visit www.oracle.com if you need additional information or have any
25 + * questions.
26 + *
27 + */
29 +#ifndef OS_CPU_SOLARIS_X86_ATOMIC_SOLARIS_X86_HPP
30 +#define OS_CPU_SOLARIS_X86_ATOMIC_SOLARIS_X86_HPP
32 +inline int32_t _Atomic_add(int32_t add_value, volatile int32_t* dest) {
33 + int32_t rv = add_value;
34 + __asm__ volatile ("lock xaddl %0,(%2)"
35 + : "=r" (rv)
36 + : "0" (rv), "r" (dest)
37 + : "cc", "memory");
38 + return rv + add_value;
40 +inline int64_t _Atomic_add_long(int64_t add_value, volatile int64_t* dest) {
41 + int64_t rv = add_value;
42 + __asm__ volatile ("lock xaddq %0,(%2)"
43 + : "=r" (rv)
44 + : "0" (rv), "r" (dest)
45 + : "cc", "memory");
46 + return rv + add_value;
48 +inline int32_t _Atomic_xchg(int32_t exchange_value, volatile int32_t* dest) {
49 + __asm__ __volatile__ ("xchgl (%2),%0"
50 + : "=r" (exchange_value)
51 + : "0" (exchange_value), "r" (dest)
52 + : "memory");
53 + return exchange_value;
55 +inline int64_t _Atomic_xchg_long(int64_t exchange_value, volatile int64_t* dest) {
56 + __asm__ __volatile__ ("xchgq (%2),%0"
57 + : "=r" (exchange_value)
58 + : "0" (exchange_value), "r" (dest)
59 + : "memory");
60 + return exchange_value;
62 +inline int8_t _Atomic_cmpxchg_byte(int8_t exchange_value, volatile int8_t* dest, int8_t compare_value) {
63 + __asm__ volatile ("lock cmpxchgb %1,(%3)"
64 + : "=a" (exchange_value)
65 + : "q" (exchange_value), "a" (compare_value), "r" (dest)
66 + : "cc", "memory");
67 + return exchange_value;
69 +inline int32_t _Atomic_cmpxchg(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
70 + __asm__ volatile ("lock cmpxchgl %1,(%3)"
71 + : "=a" (exchange_value)
72 + : "q" (exchange_value), "a" (compare_value), "r" (dest)
73 + : "cc", "memory");
74 + return exchange_value;
76 +inline int64_t _Atomic_cmpxchg_long(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
77 + __asm__ volatile ("lock cmpxchgq %1,(%3)"
78 + : "=a" (exchange_value)
79 + : "q" (exchange_value), "a" (compare_value), "r" (dest)
80 + : "cc", "memory");
81 + return exchange_value;
84 +template<size_t byte_size>
85 +struct Atomic::PlatformAdd {
86 + template<typename D, typename I>
87 + D add_then_fetch(D volatile* dest, I add_value, atomic_memory_order order) const;
89 + template<typename D, typename I>
90 + D fetch_then_add(D volatile* dest, I add_value, atomic_memory_order order) const {
91 + return add_then_fetch(dest, add_value, order) - add_value;
92 + }
93 +};
95 +// Not using add_using_helper; see comment for cmpxchg.
96 +template<>
97 +template<typename D, typename I>
98 +inline D Atomic::PlatformAdd<4>::add_then_fetch(D volatile* dest, I add_value,
99 + atomic_memory_order order) const {
100 + STATIC_ASSERT(4 == sizeof(I));
101 + STATIC_ASSERT(4 == sizeof(D));
102 + return PrimitiveConversions::cast<D>(
103 + _Atomic_add(PrimitiveConversions::cast<int32_t>(add_value),
104 + reinterpret_cast<int32_t volatile*>(dest)));
107 +// Not using add_using_helper; see comment for cmpxchg.
108 +template<>
109 +template<typename D, typename I>
110 +inline D Atomic::PlatformAdd<8>::add_then_fetch(D volatile* dest, I add_value,
111 + atomic_memory_order order) const {
112 + STATIC_ASSERT(8 == sizeof(I));
113 + STATIC_ASSERT(8 == sizeof(D));
114 + return PrimitiveConversions::cast<D>(
115 + _Atomic_add_long(PrimitiveConversions::cast<int64_t>(add_value),
116 + reinterpret_cast<int64_t volatile*>(dest)));
119 +template<>
120 +template<typename T>
121 +inline T Atomic::PlatformXchg<4>::operator()(T volatile* dest,
122 + T exchange_value,
123 + atomic_memory_order order) const {
124 + STATIC_ASSERT(4 == sizeof(T));
125 + return PrimitiveConversions::cast<T>(
126 + _Atomic_xchg(PrimitiveConversions::cast<int32_t>(exchange_value),
127 + reinterpret_cast<int32_t volatile*>(dest)));
130 +template<>
131 +template<typename T>
132 +inline T Atomic::PlatformXchg<8>::operator()(T volatile* dest,
133 + T exchange_value,
134 + atomic_memory_order order) const {
135 + STATIC_ASSERT(8 == sizeof(T));
136 + return PrimitiveConversions::cast<T>(
137 + _Atomic_xchg_long(PrimitiveConversions::cast<int64_t>(exchange_value),
138 + reinterpret_cast<int64_t volatile*>(dest)));
141 +// Not using cmpxchg_using_helper here, because some configurations of
142 +// Solaris compiler don't deal well with passing a "defined in .il"
143 +// function as an argument. We *should* switch to using gcc-style
144 +// inline assembly, but attempting to do so with Studio 12.4 ran into
145 +// segfaults.
147 +template<>
148 +template<typename T>
149 +inline T Atomic::PlatformCmpxchg<1>::operator()(T volatile* dest,
150 + T compare_value,
151 + T exchange_value,
152 + atomic_memory_order order) const {
153 + STATIC_ASSERT(1 == sizeof(T));
154 + return PrimitiveConversions::cast<T>(
155 + _Atomic_cmpxchg_byte(PrimitiveConversions::cast<int8_t>(exchange_value),
156 + reinterpret_cast<int8_t volatile*>(dest),
157 + PrimitiveConversions::cast<int8_t>(compare_value)));
160 +template<>
161 +template<typename T>
162 +inline T Atomic::PlatformCmpxchg<4>::operator()(T volatile* dest,
163 + T compare_value,
164 + T exchange_value,
165 + atomic_memory_order order) const {
166 + STATIC_ASSERT(4 == sizeof(T));
167 + return PrimitiveConversions::cast<T>(
168 + _Atomic_cmpxchg(PrimitiveConversions::cast<int32_t>(exchange_value),
169 + reinterpret_cast<int32_t volatile*>(dest),
170 + PrimitiveConversions::cast<int32_t>(compare_value)));
173 +template<>
174 +template<typename T>
175 +inline T Atomic::PlatformCmpxchg<8>::operator()(T volatile* dest,
176 + T compare_value,
177 + T exchange_value,
178 + atomic_memory_order order) const {
179 + STATIC_ASSERT(8 == sizeof(T));
180 + return PrimitiveConversions::cast<T>(
181 + _Atomic_cmpxchg_long(PrimitiveConversions::cast<int64_t>(exchange_value),
182 + reinterpret_cast<int64_t volatile*>(dest),
183 + PrimitiveConversions::cast<int64_t>(compare_value)));
186 +#endif // OS_CPU_SOLARIS_X86_ATOMIC_SOLARIS_X86_HPP
187 diff -ur -N /tmp/g/bytes_solaris_zero.inline.hpp b/src/hotspot/os_cpu/solaris_zero/bytes_solaris_zero.inline.hpp
188 --- /tmp/g/bytes_solaris_zero.hpp 1970-01-01 01:00:00.000000000 +0000
189 +++ b/src/hotspot/os_cpu/solaris_zero/bytes_solaris_zero.hpp 2020-08-31 18:20:25.351780484 +0000
190 @@ -0,0 +1,45 @@
192 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
193 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
195 + * This code is free software; you can redistribute it and/or modify it
196 + * under the terms of the GNU General Public License version 2 only, as
197 + * published by the Free Software Foundation.
199 + * This code is distributed in the hope that it will be useful, but WITHOUT
200 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
201 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
202 + * version 2 for more details (a copy is included in the LICENSE file that
203 + * accompanied this code).
205 + * You should have received a copy of the GNU General Public License version
206 + * 2 along with this work; if not, write to the Free Software Foundation,
207 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
209 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
210 + * or visit www.oracle.com if you need additional information or have any
211 + * questions.
213 + */
215 +#ifndef OS_CPU_SOLARIS_ZERO_BYTES_SOLARIS_ZERO_HPP
216 +#define OS_CPU_SOLARIS_ZERO_BYTES_SOLARIS_ZERO_HPP
218 +// Efficient swapping of data bytes from Java byte
219 +// ordering to native byte ordering and vice versa.
221 +#include <sys/byteorder.h>
223 +inline u2 Bytes::swap_u2(u2 x) {
224 + return BSWAP_16(x);
227 +inline u4 Bytes::swap_u4(u4 x) {
228 + return BSWAP_32(x);
231 +inline u8 Bytes::swap_u8(u8 x) {
232 + return BSWAP_64(x);
235 +#endif // OS_CPU_SOLARIS_ZERO_BYTES_SOLARIS_ZERO_HPP
236 diff -ur -N /tmp/g/globals_solaris_zero.hpp b/src/hotspot/os_cpu/solaris_zero/globals_solaris_zero.hpp
237 --- /tmp/g/globals_solaris_zero.hpp 1970-01-01 01:00:00.000000000 +0000
238 +++ b/src/hotspot/os_cpu/solaris_zero/globals_solaris_zero.hpp 2020-08-31 18:03:16.351225683 +0000
239 @@ -0,0 +1,40 @@
241 + * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
242 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
244 + * This code is free software; you can redistribute it and/or modify it
245 + * under the terms of the GNU General Public License version 2 only, as
246 + * published by the Free Software Foundation.
248 + * This code is distributed in the hope that it will be useful, but WITHOUT
249 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
250 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
251 + * version 2 for more details (a copy is included in the LICENSE file that
252 + * accompanied this code).
254 + * You should have received a copy of the GNU General Public License version
255 + * 2 along with this work; if not, write to the Free Software Foundation,
256 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
258 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
259 + * or visit www.oracle.com if you need additional information or have any
260 + * questions.
262 + */
264 +#ifndef OS_CPU_SOLARIS_ZERO_GLOBALS_SOLARIS_ZERO_HPP
265 +#define OS_CPU_SOLARIS_ZERO_GLOBALS_SOLARIS_ZERO_HPP
267 +// Sets the default values for platform dependent flags used by the runtime system.
268 +// (see globals.hpp)
270 +define_pd_global(bool, DontYieldALot, true); // Determined in the design center
271 +define_pd_global(intx, CompilerThreadStackSize, 1024);
272 +define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default
273 +define_pd_global(intx, VMThreadStackSize, 1024);
274 +define_pd_global(size_t, JVMInvokeMethodSlack, 8*K);
276 +// Used on 64 bit platforms for UseCompressedOops base address
277 +define_pd_global(size_t, HeapBaseMinAddress, 2*G);
279 +#endif // OS_CPU_SOLARIS_ZERO_GLOBALS_SOLARIS_ZERO_HPP
280 diff -ur -N /tmp/g/orderAccess_solaris_zero.hpp b/src/hotspot/os_cpu/solaris_zero/orderAccess_solaris_zero.hpp
281 --- /tmp/g/orderAccess_solaris_zero.hpp 1970-01-01 01:00:00.000000000 +0000
282 +++ b/src/hotspot/os_cpu/solaris_zero/orderAccess_solaris_zero.hpp 2020-08-31 18:13:46.830570494 +0000
283 @@ -0,0 +1,78 @@
285 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
286 + * Copyright 2007, 2008, 2009 Red Hat, Inc.
287 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
289 + * This code is free software; you can redistribute it and/or modify it
290 + * under the terms of the GNU General Public License version 2 only, as
291 + * published by the Free Software Foundation.
293 + * This code is distributed in the hope that it will be useful, but WITHOUT
294 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
295 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
296 + * version 2 for more details (a copy is included in the LICENSE file that
297 + * accompanied this code).
299 + * You should have received a copy of the GNU General Public License version
300 + * 2 along with this work; if not, write to the Free Software Foundation,
301 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
303 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
304 + * or visit www.oracle.com if you need additional information or have any
305 + * questions.
307 + */
309 +#ifndef OS_CPU_SOLARIS_ZERO_ORDERACCESS_SOLARIS_ZERO_HPP
310 +#define OS_CPU_SOLARIS_ZERO_ORDERACCESS_SOLARIS_ZERO_HPP
312 +// Included in orderAccess.hpp header file.
314 +#ifdef ARM
317 + * ARM Kernel helper for memory barrier.
318 + * Using __asm __volatile ("":::"memory") does not work reliable on ARM
319 + * and gcc __sync_synchronize(); implementation does not use the kernel
320 + * helper for all gcc versions so it is unreliable to use as well.
321 + */
322 +typedef void (__kernel_dmb_t) (void);
323 +#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
325 +#define FULL_MEM_BARRIER __kernel_dmb()
326 +#define LIGHT_MEM_BARRIER __kernel_dmb()
328 +#else // ARM
330 +#define FULL_MEM_BARRIER __sync_synchronize()
332 +#ifdef PPC
334 +#ifdef __NO_LWSYNC__
335 +#define LIGHT_MEM_BARRIER __asm __volatile ("sync":::"memory")
336 +#else
337 +#define LIGHT_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
338 +#endif
340 +#else // PPC
342 +#define LIGHT_MEM_BARRIER __asm __volatile ("":::"memory")
344 +#endif // PPC
346 +#endif // ARM
348 +// Note: What is meant by LIGHT_MEM_BARRIER is a barrier which is sufficient
349 +// to provide TSO semantics, i.e. StoreStore | LoadLoad | LoadStore.
351 +inline void OrderAccess::loadload() { LIGHT_MEM_BARRIER; }
352 +inline void OrderAccess::storestore() { LIGHT_MEM_BARRIER; }
353 +inline void OrderAccess::loadstore() { LIGHT_MEM_BARRIER; }
354 +inline void OrderAccess::storeload() { FULL_MEM_BARRIER; }
356 +inline void OrderAccess::acquire() { LIGHT_MEM_BARRIER; }
357 +inline void OrderAccess::release() { LIGHT_MEM_BARRIER; }
358 +inline void OrderAccess::fence() { FULL_MEM_BARRIER; }
359 +inline void OrderAccess::cross_modify_fence_impl() { }
361 +#endif // OS_CPU_SOLARIS_ZERO_ORDERACCESS_SOLARIS_ZERO_HPP
362 diff -ur -N /tmp/g/os_solaris_zero.cpp b/src/hotspot/os_cpu/solaris_zero/os_solaris_zero.cpp
363 --- /tmp/g/os_solaris_zero.cpp 1970-01-01 01:00:00.000000000 +0000
364 +++ b/src/hotspot/os_cpu/solaris_zero/os_solaris_zero.cpp 2020-09-02 13:28:22.493092922 +0000
365 @@ -0,0 +1,298 @@
367 + * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
368 + * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
369 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
371 + * This code is free software; you can redistribute it and/or modify it
372 + * under the terms of the GNU General Public License version 2 only, as
373 + * published by the Free Software Foundation.
375 + * This code is distributed in the hope that it will be useful, but WITHOUT
376 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
377 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
378 + * version 2 for more details (a copy is included in the LICENSE file that
379 + * accompanied this code).
381 + * You should have received a copy of the GNU General Public License version
382 + * 2 along with this work; if not, write to the Free Software Foundation,
383 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
385 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
386 + * or visit www.oracle.com if you need additional information or have any
387 + * questions.
389 + */
391 +#include <pthread.h> /* For pthread_attr_get_np */
393 +// no precompiled headers
394 +#include "jvm.h"
395 +#include "assembler_zero.inline.hpp"
396 +#include "classfile/classLoader.hpp"
397 +#include "classfile/systemDictionary.hpp"
398 +#include "classfile/vmSymbols.hpp"
399 +#include "code/vtableStubs.hpp"
400 +#include "interpreter/interpreter.hpp"
401 +#include "memory/allocation.inline.hpp"
402 +#include "os_solaris.hpp"
403 +#include "os_posix.hpp"
404 +#include "nativeInst_zero.hpp"
405 +#include "prims/jniFastGetField.hpp"
406 +#include "prims/jvm_misc.hpp"
407 +#include "runtime/arguments.hpp"
408 +#include "runtime/frame.inline.hpp"
409 +#include "runtime/interfaceSupport.inline.hpp"
410 +#include "runtime/java.hpp"
411 +#include "runtime/javaCalls.hpp"
412 +#include "runtime/mutexLocker.hpp"
413 +#include "runtime/osThread.hpp"
414 +#include "runtime/sharedRuntime.hpp"
415 +#include "runtime/stubRoutines.hpp"
416 +#include "runtime/thread.inline.hpp"
417 +#include "runtime/timer.hpp"
418 +#include "signals_posix.hpp"
419 +#include "utilities/events.hpp"
420 +#include "utilities/vmError.hpp"
422 +// See stubGenerator_zero.cpp
423 +#include <setjmp.h>
424 +extern sigjmp_buf* get_jmp_buf_for_continuation();
426 +address os::current_stack_pointer() {
427 + // return the address of the current function
428 + return (address)__builtin_frame_address(0);
431 +frame os::get_sender_for_C_frame(frame* fr) {
432 + ShouldNotCallThis();
433 + return frame();
436 +frame os::current_frame() {
437 + // The only thing that calls this is the stack printing code in
438 + // VMError::report:
439 + // - Step 110 (printing stack bounds) uses the sp in the frame
440 + // to determine the amount of free space on the stack. We
441 + // set the sp to a close approximation of the real value in
442 + // order to allow this step to complete.
443 + // - Step 120 (printing native stack) tries to walk the stack.
444 + // The frame we create has a NULL pc, which is ignored as an
445 + // invalid frame.
446 + frame dummy = frame();
447 + dummy.set_sp((intptr_t *) current_stack_pointer());
448 + return dummy;
451 +char* os::non_memory_address_word() {
452 + // Must never look like an address returned by reserve_memory,
453 + // even in its subfields (as defined by the CPU immediate fields,
454 + // if the CPU splits constants across multiple instructions).
455 + // This is the value for x86; works pretty well for PPC too.
456 + return (char *) -1;
459 +address os::Posix::ucontext_get_pc(const ucontext_t* uc) {
460 + ShouldNotCallThis();
461 + return NULL;
464 +void os::Posix::ucontext_set_pc(ucontext_t * uc, address pc) {
465 + ShouldNotCallThis();
468 +address os::fetch_frame_from_context(const void* ucVoid,
469 + intptr_t** ret_sp,
470 + intptr_t** ret_fp) {
471 + ShouldNotCallThis();
472 + return NULL;
475 +frame os::fetch_frame_from_context(const void* ucVoid) {
476 + ShouldNotCallThis();
477 + return frame();
480 +bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
481 + ucontext_t* uc, JavaThread* thread) {
483 + if (info != NULL && thread != NULL) {
484 + // Handle ALL stack overflow variations here
485 + if (sig == SIGSEGV || sig == SIGBUS) {
486 + address addr = (address) info->si_addr;
488 + // check if fault address is within thread stack
489 + if (thread->is_in_full_stack(addr)) {
490 + StackOverflow* overflow_state = thread->stack_overflow_state();
491 + // stack overflow
492 + if (overflow_state->in_stack_yellow_reserved_zone(addr)) {
493 + overflow_state->disable_stack_yellow_reserved_zone();
494 + ShouldNotCallThis();
496 + else if (overflow_state->in_stack_red_zone(addr)) {
497 + overflow_state->disable_stack_red_zone();
498 + ShouldNotCallThis();
503 + /*if (thread->thread_state() == _thread_in_Java) {
504 + ShouldNotCallThis();
506 + else*/ if ((thread->thread_state() == _thread_in_vm ||
507 + thread->thread_state() == _thread_in_native) &&
508 + sig == SIGBUS && thread->doing_unsafe_access()) {
509 + ShouldNotCallThis();
512 + // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC
513 + // kicks in and the heap gets shrunk before the field access.
514 + /*if (sig == SIGSEGV || sig == SIGBUS) {
515 + address addr = JNI_FastGetField::find_slowcase_pc(pc);
516 + if (addr != (address)-1) {
517 + stub = addr;
519 + }*/
522 + return false;
525 +void os::Solaris::init_thread_fpu_state(void) {
526 + // Nothing to do
529 +// Minimum usable stack sizes required to get to user code. Space for
530 +// HotSpot guard pages is added later.
531 +#ifdef _LP64
532 +// The adlc generated method 'State::MachNodeGenerator(int)' used by the C2 compiler
533 +// threads requires a large stack with the Solaris Studio C++ compiler version 5.13
534 +// and product VM builds (debug builds require significantly less stack space).
535 +size_t os::_compiler_thread_min_stack_allowed = 325 * K;
536 +size_t os::_java_thread_min_stack_allowed = 48 * K;
537 +size_t os::_vm_internal_thread_min_stack_allowed = 224 * K;
538 +#else
539 +size_t os::_compiler_thread_min_stack_allowed = 32 * K;
540 +size_t os::_java_thread_min_stack_allowed = 32 * K;
541 +size_t os::_vm_internal_thread_min_stack_allowed = 64 * K;
542 +#endif // _LP64
544 +/////////////////////////////////////////////////////////////////////////////
545 +// helper functions for fatal error handler
547 +void os::print_context(outputStream* st, const void* context) {
548 + ShouldNotCallThis();
551 +void os::print_tos_pc(outputStream* st, const void* context) {
552 + ShouldNotCallThis();
555 +void os::print_register_info(outputStream *st, const void *context, int& continuation) {
556 + st->print_cr("No register info.");
559 +// Atomically copy 64 bits of data
560 +static inline void atomic_copy64(const volatile void *src, volatile void *dst) {
561 + *(jlong *) dst = *(const jlong *) src;
564 +/////////////////////////////////////////////////////////////////////////////
565 +// Stubs for things that would be in solaris_zero.s if it existed.
566 +// You probably want to disassemble these monkeys to check they're ok.
568 +extern "C" {
569 + int SpinPause() {
570 + return 1;
573 + void _Copy_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) {
574 + if (from > to) {
575 + const jshort *end = from + count;
576 + while (from < end)
577 + *(to++) = *(from++);
579 + else if (from < to) {
580 + const jshort *end = from;
581 + from += count - 1;
582 + to += count - 1;
583 + while (from >= end)
584 + *(to--) = *(from--);
587 + void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) {
588 + if (from > to) {
589 + const jint *end = from + count;
590 + while (from < end)
591 + *(to++) = *(from++);
593 + else if (from < to) {
594 + const jint *end = from;
595 + from += count - 1;
596 + to += count - 1;
597 + while (from >= end)
598 + *(to--) = *(from--);
601 + void _Copy_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) {
602 + if (from > to) {
603 + const jlong *end = from + count;
604 + while (from < end)
605 + atomic_copy64(from++, to++);
607 + else if (from < to) {
608 + const jlong *end = from;
609 + from += count - 1;
610 + to += count - 1;
611 + while (from >= end)
612 + atomic_copy64(from--, to--);
616 + void _Copy_arrayof_conjoint_bytes(const HeapWord* from,
617 + HeapWord* to,
618 + size_t count) {
619 + memmove(to, from, count);
621 + void _Copy_arrayof_conjoint_jshorts(const HeapWord* from,
622 + HeapWord* to,
623 + size_t count) {
624 + memmove(to, from, count * 2);
626 + void _Copy_arrayof_conjoint_jints(const HeapWord* from,
627 + HeapWord* to,
628 + size_t count) {
629 + memmove(to, from, count * 4);
631 + void _Copy_arrayof_conjoint_jlongs(const HeapWord* from,
632 + HeapWord* to,
633 + size_t count) {
634 + memmove(to, from, count * 8);
638 +/////////////////////////////////////////////////////////////////////////////
639 +// Implementations of atomic operations not supported by processors.
640 +// -- http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Atomic-Builtins.html
642 +#ifndef _LP64
643 +extern "C" {
644 + long long unsigned int __sync_val_compare_and_swap_8(
645 + volatile void *ptr,
646 + long long unsigned int oldval,
647 + long long unsigned int newval) {
648 + ShouldNotCallThis();
651 +#endif // !_LP64
653 +void os::setup_fpu() {}
655 +#ifndef PRODUCT
656 +void os::verify_stack_alignment() {
658 +#endif
660 +int os::extra_bang_size_in_bytes() {
661 + // Zero does not require an additional stack bang.
662 + return 0;
664 diff -ur -N /tmp/g/os_solaris_zero.hpp b/src/hotspot/os_cpu/solaris_zero/os_solaris_zero.hpp
665 --- /tmp/g/os_solaris_zero.hpp 1970-01-01 01:00:00.000000000 +0000
666 +++ b/src/hotspot/os_cpu/solaris_zero/os_solaris_zero.hpp 2020-09-01 22:01:25.502220121 +0000
667 @@ -0,0 +1,62 @@
669 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
670 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
672 + * This code is free software; you can redistribute it and/or modify it
673 + * under the terms of the GNU General Public License version 2 only, as
674 + * published by the Free Software Foundation.
676 + * This code is distributed in the hope that it will be useful, but WITHOUT
677 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
678 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
679 + * version 2 for more details (a copy is included in the LICENSE file that
680 + * accompanied this code).
682 + * You should have received a copy of the GNU General Public License version
683 + * 2 along with this work; if not, write to the Free Software Foundation,
684 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
686 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
687 + * or visit www.oracle.com if you need additional information or have any
688 + * questions.
690 + */
692 +#ifndef OS_CPU_SOLARIS_ZERO_OS_SOLARIS_ZERO_HPP
693 +#define OS_CPU_SOLARIS_ZERO_OS_SOLARIS_ZERO_HPP
695 + //
696 + // NOTE: we are back in class os here, not Solaris
697 + //
698 +#ifdef AMD64
699 + static void setup_fpu() {}
700 +#else
701 + static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
702 + static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
703 + static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t);
704 + static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
706 + static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
707 + static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
708 + static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
709 + static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
711 + static void setup_fpu() {}
712 +#endif // AMD64
714 + static juint cpu_microcode_revision();
716 + static jlong rdtsc();
718 + static bool is_allocatable(size_t bytes);
720 + // Used to register dynamic code cache area with the OS
721 + // Note: Currently only used in 64 bit Windows implementations
722 + static bool register_code_area(char *low, char *high) { return true; }
724 + // Atomically copy 64 bits of data
725 + static void atomic_copy64(const volatile void *src, volatile void *dst) {
726 + *(jlong *) dst = *(const jlong *) src;
729 +#endif // OS_CPU_SOLARIS_ZERO_OS_SOLARIS_ZERO_HPP
730 diff -ur -N /tmp/g/prefetch_solaris_zero.inline.hpp b/src/hotspot/os_cpu/solaris_zero/prefetch_solaris_zero.inline.hpp
731 --- /tmp/g/prefetch_solaris_zero.inline.hpp 1970-01-01 01:00:00.000000000 +0000
732 +++ b/src/hotspot/os_cpu/solaris_zero/prefetch_solaris_zero.inline.hpp 2020-09-01 21:42:41.412265130 +0000
733 @@ -0,0 +1,37 @@
735 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
736 + * Copyright 2007, 2008 Red Hat, Inc.
737 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
739 + * This code is free software; you can redistribute it and/or modify it
740 + * under the terms of the GNU General Public License version 2 only, as
741 + * published by the Free Software Foundation.
743 + * This code is distributed in the hope that it will be useful, but WITHOUT
744 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
745 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
746 + * version 2 for more details (a copy is included in the LICENSE file that
747 + * accompanied this code).
749 + * You should have received a copy of the GNU General Public License version
750 + * 2 along with this work; if not, write to the Free Software Foundation,
751 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
753 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
754 + * or visit www.oracle.com if you need additional information or have any
755 + * questions.
757 + */
759 +#ifndef OS_CPU_SOLARIS_ZERO_PREFETCH_SOLARIS_ZERO_INLINE_HPP
760 +#define OS_CPU_SOLARIS_ZERO_PREFETCH_SOLARIS_ZERO_INLINE_HPP
762 +#include "runtime/prefetch.hpp"
764 +inline void Prefetch::read(const void *loc, intx interval) {
767 +inline void Prefetch::write(void *loc, intx interval) {
770 +#endif // OS_CPU_SOLARIS_ZERO_PREFETCH_SOLARIS_ZERO_INLINE_HPP
771 diff -ur -N /tmp/g/javaThread_solaris_zero.cpp b/src/hotspot/os_cpu/solaris_zero/javaThread_solaris_zero.cpp
772 --- /tmp/g/javaThread_solaris_zero.cpp 1970-01-01 01:00:00.000000000 +0000
773 +++ b/src/hotspot/os_cpu/solaris_zero/javaThread_solaris_zero.cpp 2020-09-01 21:40:25.604734766 +0000
774 @@ -0,0 +1,37 @@
776 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
777 + * Copyright 2009, 2010 Red Hat, Inc.
778 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
780 + * This code is free software; you can redistribute it and/or modify it
781 + * under the terms of the GNU General Public License version 2 only, as
782 + * published by the Free Software Foundation.
784 + * This code is distributed in the hope that it will be useful, but WITHOUT
785 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
786 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
787 + * version 2 for more details (a copy is included in the LICENSE file that
788 + * accompanied this code).
790 + * You should have received a copy of the GNU General Public License version
791 + * 2 along with this work; if not, write to the Free Software Foundation,
792 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
794 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
795 + * or visit www.oracle.com if you need additional information or have any
796 + * questions.
798 + */
800 +#include "precompiled.hpp"
801 +#include "runtime/frame.inline.hpp"
802 +#include "runtime/javaThread.hpp"
804 +frame JavaThread::pd_last_frame() {
805 + assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
806 + return frame(last_Java_fp(), last_Java_sp());
809 +void JavaThread::cache_global_variables() {
810 + // nothing to do
812 diff -ur -N /tmp/g/javaThread_solaris_zero.hpp b/src/hotspot/os_cpu/solaris_zero/javaThread_solaris_zero.hpp
813 --- /tmp/g/javaThread_solaris_zero.hpp 1970-01-01 01:00:00.000000000 +0000
814 +++ b/src/hotspot/os_cpu/solaris_zero/javaThread_solaris_zero.hpp 2020-09-01 21:39:59.895910869 +0000
815 @@ -0,0 +1,104 @@
817 + * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
818 + * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
819 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
821 + * This code is free software; you can redistribute it and/or modify it
822 + * under the terms of the GNU General Public License version 2 only, as
823 + * published by the Free Software Foundation.
825 + * This code is distributed in the hope that it will be useful, but WITHOUT
826 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
827 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
828 + * version 2 for more details (a copy is included in the LICENSE file that
829 + * accompanied this code).
831 + * You should have received a copy of the GNU General Public License version
832 + * 2 along with this work; if not, write to the Free Software Foundation,
833 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
835 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
836 + * or visit www.oracle.com if you need additional information or have any
837 + * questions.
839 + */
841 +#ifndef OS_CPU_SOLARIS_ZERO_JAVATHREAD_SOLARIS_ZERO_HPP
842 +#define OS_CPU_SOLARIS_ZERO_JAVATHREAD_SOLARIS_ZERO_HPP
844 + private:
845 + ZeroStack _zero_stack;
846 + ZeroFrame* _top_zero_frame;
848 + void pd_initialize() {
849 + _top_zero_frame = NULL;
852 + public:
853 + ZeroStack *zero_stack() {
854 + return &_zero_stack;
857 + public:
858 + ZeroFrame *top_zero_frame() {
859 + return _top_zero_frame;
861 + void push_zero_frame(ZeroFrame *frame) {
862 + *(ZeroFrame **) frame = _top_zero_frame;
863 + _top_zero_frame = frame;
865 + void pop_zero_frame() {
866 + zero_stack()->set_sp((intptr_t *) _top_zero_frame + 1);
867 + _top_zero_frame = *(ZeroFrame **) _top_zero_frame;
870 + public:
871 + static ByteSize zero_stack_offset() {
872 + return byte_offset_of(JavaThread, _zero_stack);
874 + static ByteSize top_zero_frame_offset() {
875 + return byte_offset_of(JavaThread, _top_zero_frame);
878 + public:
879 + void set_last_Java_frame() {
880 + set_last_Java_frame(top_zero_frame(), zero_stack()->sp());
882 + void reset_last_Java_frame() {
883 + frame_anchor()->zap();
885 + void set_last_Java_frame(ZeroFrame* fp, intptr_t* sp) {
886 + frame_anchor()->set(sp, NULL, fp);
889 + public:
890 + ZeroFrame* last_Java_fp() {
891 + return frame_anchor()->last_Java_fp();
894 + private:
895 + frame pd_last_frame();
897 + public:
898 + static ByteSize last_Java_fp_offset() {
899 + return byte_offset_of(JavaThread, _anchor) +
900 + JavaFrameAnchor::last_Java_fp_offset();
903 + public:
904 + // Check for pending suspend requests and pending asynchronous
905 + // exceptions. There are separate accessors for these, but
906 + // _suspend_flags is volatile so using them would be unsafe.
907 + bool has_special_condition_for_native_trans() {
908 + return _suspend_flags != 0;
911 + public:
912 + bool pd_get_top_frame_for_signal_handler(frame* fr_addr,
913 + void* ucontext,
914 + bool isInJava) {
915 + ShouldNotCallThis();
916 + return false;
919 +#endif // OS_CPU_SOLARIS_ZERO_JAVATHREAD_SOLARIS_ZERO_HPP
920 diff -ur -N /tmp/g/vmStructs_solaris_zero.hpp b/src/hotspot/os_cpu/solaris_zero/vmStructs_solaris_zero.hpp
921 --- /tmp/g/vmStructs_solaris_zero.hpp 1970-01-01 01:00:00.000000000 +0000
922 +++ b/src/hotspot/os_cpu/solaris_zero/vmStructs_solaris_zero.hpp 2020-09-01 21:48:37.312847065 +0000
923 @@ -0,0 +1,42 @@
925 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
926 + * Copyright 2007 Red Hat, Inc.
927 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
929 + * This code is free software; you can redistribute it and/or modify it
930 + * under the terms of the GNU General Public License version 2 only, as
931 + * published by the Free Software Foundation.
933 + * This code is distributed in the hope that it will be useful, but WITHOUT
934 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
935 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
936 + * version 2 for more details (a copy is included in the LICENSE file that
937 + * accompanied this code).
939 + * You should have received a copy of the GNU General Public License version
940 + * 2 along with this work; if not, write to the Free Software Foundation,
941 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
943 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
944 + * or visit www.oracle.com if you need additional information or have any
945 + * questions.
947 + */
949 +#ifndef OS_CPU_SOLARIS_ZERO_VMSTRUCTS_SOLARIS_ZERO_HPP
950 +#define OS_CPU_SOLARIS_ZERO_VMSTRUCTS_SOLARIS_ZERO_HPP
952 +// These are the OS and CPU-specific fields, types and integer
953 +// constants required by the Serviceability Agent. This file is
954 +// referenced by vmStructs.cpp.
956 +#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)
959 +#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
961 +#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
963 +#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
965 +#endif // OS_CPU_SOLARIS_ZERO_VMSTRUCTS_SOLARIS_ZERO_HPP
966 --- /dev/null 2022-08-12 13:25:23.000000000 +0000
967 +++ b/src/hotspot/os_cpu/solaris_zero/os_solaris_zero.inline.hpp 2022-08-12 08:53:34.279529742 +0000
968 @@ -0,0 +1,30 @@
970 + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
971 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
973 + * This code is free software; you can redistribute it and/or modify it
974 + * under the terms of the GNU General Public License version 2 only, as
975 + * published by the Free Software Foundation.
977 + * This code is distributed in the hope that it will be useful, but WITHOUT
978 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
979 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
980 + * version 2 for more details (a copy is included in the LICENSE file that
981 + * accompanied this code).
983 + * You should have received a copy of the GNU General Public License version
984 + * 2 along with this work; if not, write to the Free Software Foundation,
985 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
987 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
988 + * or visit www.oracle.com if you need additional information or have any
989 + * questions.
991 + */
993 +#ifndef OS_CPU_SOLARIS_ZERO_OS_SOLARIS_ZERO_INLINE_HPP
994 +#define OS_CPU_SOLARIS_ZERO_OS_SOLARIS_ZERO_INLINE_HPP
998 +#endif // OS_CPU_SOLARIS_ZERO_OS_SOLARIS_ZERO_INLINE_HPP