Skip to content

Commit 6a6c38c

Browse files
committed
Revert "Pull/2200 (openjdk#5)"
This reverts commit a9452a4.
1 parent 1189346 commit 6a6c38c

File tree

3 files changed

+50
-15
lines changed

3 files changed

+50
-15
lines changed

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
774774
return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry, c2i_no_clinit_check_entry);
775775
}
776776

777-
static int c_calling_convention_priv(const BasicType *sig_bt,
777+
int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
778778
VMRegPair *regs,
779779
VMRegPair *regs2,
780780
int total_args_passed) {
@@ -863,16 +863,6 @@ static int c_calling_convention_priv(const BasicType *sig_bt,
863863
return stk_args;
864864
}
865865

866-
int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
867-
VMRegPair *regs,
868-
VMRegPair *regs2,
869-
int total_args_passed)
870-
{
871-
int result = c_calling_convention_priv(sig_bt, regs, regs2, total_args_passed);
872-
guarantee(result >= 0, "Unsupported arguments configuration");
873-
return result;
874-
}
875-
876866
// On 64 bit we will store integer like items to the stack as
877867
// 64 bits items (Aarch64 abi) even though java would only store
878868
// 32bits for a parameter. On 32bit it will simply be 32 bits
@@ -1378,7 +1368,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
13781368
// Now figure out where the args must be stored and how much stack space
13791369
// they require.
13801370
int out_arg_slots;
1381-
out_arg_slots = c_calling_convention_priv(out_sig_bt, out_regs, NULL, total_c_args);
1371+
out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
13821372

13831373
if (out_arg_slots < 0) {
13841374
return NULL;

src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ inline T Atomic::PlatformXchg<byte_size>::operator()(T volatile* dest,
5757
return res;
5858
}
5959

60+
// __attribute__((unused)) on dest is to get rid of spurious GCC warnings.
6061
template<size_t byte_size>
6162
template<typename T>
62-
inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T volatile* dest,
63+
inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T volatile* dest __attribute__((unused)),
6364
T compare_value,
6465
T exchange_value,
6566
atomic_memory_order order) const {

src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
# include <stdio.h>
6868
# include <unistd.h>
6969
# include <sys/resource.h>
70+
# include <pthread.h>
7071
# include <sys/stat.h>
7172
# include <sys/time.h>
7273
# include <sys/utsname.h>
@@ -82,14 +83,27 @@
8283
# include <pthread_np.h>
8384
#endif
8485

86+
// needed by current_stack_region() workaround for Mavericks
87+
#if defined(__APPLE__)
88+
# include <errno.h>
89+
# include <sys/types.h>
90+
# include <sys/sysctl.h>
91+
# define DEFAULT_MAIN_THREAD_STACK_PAGES 2048
92+
# define OS_X_10_9_0_KERNEL_MAJOR_VERSION 13
93+
#endif
94+
8595
#define SPELL_REG_SP "sp"
8696
#define SPELL_REG_FP "fp"
8797

8898
#ifdef __APPLE__
8999
// see darwin-xnu/osfmk/mach/arm/_structs.h
90100

91-
// 10.5 UNIX03 member name prefixes
92-
#define DU3_PREFIX(s, m) __ ## s.__ ## m
101+
# if __DARWIN_UNIX03 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
102+
// 10.5 UNIX03 member name prefixes
103+
#define DU3_PREFIX(s, m) __ ## s.__ ## m
104+
# else
105+
#define DU3_PREFIX(s, m) s ## . ## m
106+
# endif
93107
#endif
94108

95109
#define context_x uc_mcontext->DU3_PREFIX(ss,x)
@@ -199,6 +213,15 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
199213
// point of execution.
200214
ThreadWXEnable wx(WXWrite, thread);
201215

216+
/*
217+
NOTE: does not seem to work on bsd.
218+
if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
219+
// can't decode this kind of signal
220+
info = NULL;
221+
} else {
222+
assert(sig == info->si_signo, "bad siginfo");
223+
}
224+
*/
202225
// decide if this trap can be handled by a stub
203226
address stub = NULL;
204227

@@ -356,6 +379,27 @@ static void current_stack_region(address * bottom, size_t * size) {
356379
pthread_t self = pthread_self();
357380
void *stacktop = pthread_get_stackaddr_np(self);
358381
*size = pthread_get_stacksize_np(self);
382+
// workaround for OS X 10.9.0 (Mavericks)
383+
// pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages
384+
if (pthread_main_np() == 1) {
385+
// At least on Mac OS 10.12 we have observed stack sizes not aligned
386+
// to pages boundaries. This can be provoked by e.g. setrlimit() (ulimit -s xxxx in the
387+
// shell). Apparently Mac OS actually rounds upwards to next multiple of page size,
388+
// however, we round downwards here to be on the safe side.
389+
*size = align_down(*size, getpagesize());
390+
391+
if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) {
392+
char kern_osrelease[256];
393+
size_t kern_osrelease_size = sizeof(kern_osrelease);
394+
int ret = sysctlbyname("kern.osrelease", kern_osrelease, &kern_osrelease_size, NULL, 0);
395+
if (ret == 0) {
396+
// get the major number, atoi will ignore the minor amd micro portions of the version string
397+
if (atoi(kern_osrelease) >= OS_X_10_9_0_KERNEL_MAJOR_VERSION) {
398+
*size = (DEFAULT_MAIN_THREAD_STACK_PAGES*getpagesize());
399+
}
400+
}
401+
}
402+
}
359403
*bottom = (address) stacktop - *size;
360404
#elif defined(__OpenBSD__)
361405
stack_t ss;

0 commit comments

Comments
 (0)