Skip to content
Permalink
Browse files
8265453: SafepointMechanism::should_process() should receive JavaThread*
Reviewed-by: dcubed, shade, dholmes
  • Loading branch information
pchilano committed Apr 22, 2021
1 parent fa82d47 commit 6d49cc3b655433d00e967fdcec3f3759412cd925
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -551,8 +551,9 @@ int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
}

int ZeroInterpreter::getter_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
// Drop into the slow path if we need a safepoint check
if (SafepointMechanism::should_process(THREAD)) {
if (SafepointMechanism::should_process(thread)) {
return normal_entry(method, 0, THREAD);
}

@@ -577,7 +578,6 @@ int ZeroInterpreter::getter_entry(Method* method, intptr_t UNUSED, TRAPS) {
return normal_entry(method, 0, THREAD);
}

JavaThread* thread = THREAD->as_Java_thread();
ZeroStack* stack = thread->zero_stack();
intptr_t* topOfStack = stack->sp();

@@ -639,8 +639,9 @@ int ZeroInterpreter::getter_entry(Method* method, intptr_t UNUSED, TRAPS) {
}

int ZeroInterpreter::setter_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
// Drop into the slow path if we need a safepoint check
if (SafepointMechanism::should_process(THREAD)) {
if (SafepointMechanism::should_process(thread)) {
return normal_entry(method, 0, THREAD);
}

@@ -666,7 +667,6 @@ int ZeroInterpreter::setter_entry(Method* method, intptr_t UNUSED, TRAPS) {
return normal_entry(method, 0, THREAD);
}

JavaThread* thread = THREAD->as_Java_thread();
ZeroStack* stack = thread->zero_stack();
intptr_t* topOfStack = stack->sp();

@@ -734,7 +734,7 @@ int ZeroInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
ZeroStack *stack = thread->zero_stack();

// Drop into the slow path if we need a safepoint check
if (SafepointMechanism::should_process(THREAD)) {
if (SafepointMechanism::should_process(thread)) {
return normal_entry(method, 0, THREAD);
}

@@ -48,7 +48,6 @@ class SafepointMechanism : public AllStatic {

static inline void disarm_local_poll(JavaThread* thread);

static inline bool local_poll(Thread* thread);
static inline bool global_poll();

static void process(JavaThread *thread);
@@ -80,7 +79,7 @@ class SafepointMechanism : public AllStatic {
};

// Call this method to see if this thread should block for a safepoint or process handshake.
static inline bool should_process(Thread* thread);
static inline bool should_process(JavaThread* thread);

// Processes a pending requested operation.
static inline void process_if_requested(JavaThread* thread);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,24 +60,14 @@ bool SafepointMechanism::global_poll() {
return (SafepointSynchronize::_state != SafepointSynchronize::_not_synchronized);
}

bool SafepointMechanism::local_poll(Thread* thread) {
if (thread->is_Java_thread()) {
return local_poll_armed(thread->as_Java_thread());
} else {
// If the poll is on a non-java thread we can only check the global state.
return global_poll();
}
}

bool SafepointMechanism::should_process(Thread* thread) {
return local_poll(thread);
bool SafepointMechanism::should_process(JavaThread* thread) {
return local_poll_armed(thread);
}

void SafepointMechanism::process_if_requested(JavaThread *thread) {
if (!local_poll_armed(thread)) {
return;
void SafepointMechanism::process_if_requested(JavaThread* thread) {
if (local_poll_armed(thread)) {
process_if_requested_slow(thread);
}
process_if_requested_slow(thread);
}

void SafepointMechanism::process_if_requested_with_exit_check(JavaThread* thread, bool check_asyncs) {

1 comment on commit 6d49cc3

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 6d49cc3 Apr 22, 2021

Please sign in to comment.