< prev index next >

src/hotspot/share/runtime/continuation.hpp

Print this page

  1 /*
  2  * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  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
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 30 #include "oops/oopsHierarchy.hpp"
 31 
 32 class ContinuationEntry;
 33 class frame;
 34 class FrameValues;
 35 class Handle;
 36 class outputStream;
 37 class RegisterMap;
 38 
 39 class Continuations : public AllStatic {
 40 public:
 41   static void init();
 42   static bool enabled();
 43 };
 44 
 45 void continuations_init();
 46 
 47 class javaVFrame;
 48 class JavaThread;
 49 












 50 class Continuation : AllStatic {
 51 public:
 52 





 53   enum thaw_kind {
 54     thaw_top = 0,
 55     thaw_return_barrier = 1,
 56     thaw_return_barrier_exception = 2,
 57   };
 58 
 59   static bool is_thaw_return_barrier(thaw_kind kind) {
 60     return kind != thaw_top;
 61   }
 62 
 63   static bool is_thaw_return_barrier_exception(thaw_kind kind) {
 64     bool r = (kind == thaw_return_barrier_exception);
 65     assert(!r || is_thaw_return_barrier(kind), "must be");
 66     return r;
 67   }
 68 
 69   static void init();
 70 
 71   static address freeze_entry();

 72   static int prepare_thaw(JavaThread* thread, bool return_barrier);
 73   static address thaw_entry();
 74 


 75   static ContinuationEntry* get_continuation_entry_for_continuation(JavaThread* thread, oop continuation);
 76   static ContinuationEntry* get_continuation_entry_for_sp(JavaThread* thread, intptr_t* const sp);
 77   static ContinuationEntry* get_continuation_entry_for_entry_frame(JavaThread* thread, const frame& f);
 78 
 79   static bool is_continuation_mounted(JavaThread* thread, oop continuation);
 80 
 81   static bool is_cont_barrier_frame(const frame& f);
 82   static bool is_return_barrier_entry(const address pc);
 83   static bool is_continuation_enterSpecial(const frame& f);
 84   static bool is_continuation_entry_frame(const frame& f, const RegisterMap *map);
 85 
 86   static bool is_frame_in_continuation(const ContinuationEntry* entry, const frame& f);
 87   static bool is_frame_in_continuation(JavaThread* thread, const frame& f);
 88 
 89   static bool has_last_Java_frame(oop continuation, frame* frame, RegisterMap* map);
 90   static frame last_frame(oop continuation, RegisterMap *map);
 91   static frame top_frame(const frame& callee, RegisterMap* map);
 92   static javaVFrame* last_java_vframe(Handle continuation, RegisterMap *map);
 93   static frame continuation_parent_frame(RegisterMap* map);
 94 

  1 /*
  2  * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  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
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 30 #include "oops/oopsHierarchy.hpp"
 31 
 32 class ContinuationEntry;
 33 class frame;
 34 class FrameValues;
 35 class Handle;
 36 class outputStream;
 37 class RegisterMap;
 38 
 39 class Continuations : public AllStatic {
 40 public:
 41   static void init();
 42   static bool enabled();
 43 };
 44 
 45 void continuations_init();
 46 
 47 class javaVFrame;
 48 class JavaThread;
 49 
 50 // should match Continuation.toPreemptStatus() in Continuation.java
 51 enum freeze_result {
 52   freeze_ok = 0,
 53   freeze_ok_bottom = 1,
 54   freeze_pinned_cs = 2,
 55   freeze_pinned_native = 3,
 56   freeze_pinned_monitor = 4,
 57   freeze_exception = 5,
 58   freeze_not_mounted = 6,
 59   freeze_unsupported = 7
 60 };
 61 
 62 class Continuation : AllStatic {
 63 public:
 64 
 65   enum preempt_kind {
 66     freeze_on_monitorenter = 1,
 67     freeze_on_wait         = 2
 68   };
 69 
 70   enum thaw_kind {
 71     thaw_top = 0,
 72     thaw_return_barrier = 1,
 73     thaw_return_barrier_exception = 2,
 74   };
 75 
 76   static bool is_thaw_return_barrier(thaw_kind kind) {
 77     return kind != thaw_top;
 78   }
 79 
 80   static bool is_thaw_return_barrier_exception(thaw_kind kind) {
 81     bool r = (kind == thaw_return_barrier_exception);
 82     assert(!r || is_thaw_return_barrier(kind), "must be");
 83     return r;
 84   }
 85 
 86   static void init();
 87 
 88   static address freeze_entry();
 89   static address freeze_preempt_entry();
 90   static int prepare_thaw(JavaThread* thread, bool return_barrier);
 91   static address thaw_entry();
 92 
 93   static int try_preempt(JavaThread* target, oop continuation, preempt_kind preempt_kind) NOT_LOOM_MONITOR_SUPPORT({ return freeze_unsupported; });
 94 
 95   static ContinuationEntry* get_continuation_entry_for_continuation(JavaThread* thread, oop continuation);
 96   static ContinuationEntry* get_continuation_entry_for_sp(JavaThread* thread, intptr_t* const sp);
 97   static ContinuationEntry* get_continuation_entry_for_entry_frame(JavaThread* thread, const frame& f);
 98 
 99   static bool is_continuation_mounted(JavaThread* thread, oop continuation);
100 
101   static bool is_cont_barrier_frame(const frame& f);
102   static bool is_return_barrier_entry(const address pc);
103   static bool is_continuation_enterSpecial(const frame& f);
104   static bool is_continuation_entry_frame(const frame& f, const RegisterMap *map);
105 
106   static bool is_frame_in_continuation(const ContinuationEntry* entry, const frame& f);
107   static bool is_frame_in_continuation(JavaThread* thread, const frame& f);
108 
109   static bool has_last_Java_frame(oop continuation, frame* frame, RegisterMap* map);
110   static frame last_frame(oop continuation, RegisterMap *map);
111   static frame top_frame(const frame& callee, RegisterMap* map);
112   static javaVFrame* last_java_vframe(Handle continuation, RegisterMap *map);
113   static frame continuation_parent_frame(RegisterMap* map);
114 
< prev index next >