26 #define SHARE_VM_CODE_COMPILEDIC_HPP |
26 #define SHARE_VM_CODE_COMPILEDIC_HPP |
27 |
27 |
28 #include "code/nativeInst.hpp" |
28 #include "code/nativeInst.hpp" |
29 #include "interpreter/linkResolver.hpp" |
29 #include "interpreter/linkResolver.hpp" |
30 #include "oops/compiledICHolder.hpp" |
30 #include "oops/compiledICHolder.hpp" |
|
31 #include "runtime/safepointVerifiers.hpp" |
31 |
32 |
32 //----------------------------------------------------------------------------- |
33 //----------------------------------------------------------------------------- |
33 // The CompiledIC represents a compiled inline cache. |
34 // The CompiledIC represents a compiled inline cache. |
34 // |
35 // |
35 // In order to make patching of the inline cache MT-safe, we only allow the following |
36 // In order to make patching of the inline cache MT-safe, we only allow the following |
65 |
66 |
66 class CompiledICLocker: public StackObj { |
67 class CompiledICLocker: public StackObj { |
67 CompiledMethod* _method; |
68 CompiledMethod* _method; |
68 CompiledICProtectionBehaviour* _behaviour; |
69 CompiledICProtectionBehaviour* _behaviour; |
69 bool _locked; |
70 bool _locked; |
|
71 NoSafepointVerifier _nsv; |
70 |
72 |
71 public: |
73 public: |
72 CompiledICLocker(CompiledMethod* method); |
74 CompiledICLocker(CompiledMethod* method); |
73 ~CompiledICLocker(); |
75 ~CompiledICLocker(); |
74 static bool is_safe(CompiledMethod* method); |
76 static bool is_safe(CompiledMethod* method); |
270 // Note: We do not provide any direct access to the stub code, to prevent parts of the code |
272 // Note: We do not provide any direct access to the stub code, to prevent parts of the code |
271 // to manipulate the inline cache in MT-unsafe ways. |
273 // to manipulate the inline cache in MT-unsafe ways. |
272 // |
274 // |
273 // They all takes a TRAP argument, since they can cause a GC if the inline-cache buffer is full. |
275 // They all takes a TRAP argument, since they can cause a GC if the inline-cache buffer is full. |
274 // |
276 // |
275 void set_to_clean(bool in_use = true); |
277 bool set_to_clean(bool in_use = true); |
276 void set_to_monomorphic(CompiledICInfo& info); |
278 bool set_to_monomorphic(CompiledICInfo& info); |
277 void clear_ic_stub(); |
279 void clear_ic_stub(); |
278 |
280 |
279 // Returns true if successful and false otherwise. The call can fail if memory |
281 // Returns true if successful and false otherwise. The call can fail if memory |
280 // allocation in the code cache fails. |
282 // allocation in the code cache fails, or ic stub refill is required. |
281 bool set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS); |
283 bool set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, bool& needs_ic_stub_refill, TRAPS); |
282 |
284 |
283 static void compute_monomorphic_entry(const methodHandle& method, Klass* receiver_klass, |
285 static void compute_monomorphic_entry(const methodHandle& method, Klass* receiver_klass, |
284 bool is_optimized, bool static_bound, bool caller_is_nmethod, |
286 bool is_optimized, bool static_bound, bool caller_is_nmethod, |
285 CompiledICInfo& info, TRAPS); |
287 CompiledICInfo& info, TRAPS); |
286 |
288 |
370 public: |
372 public: |
371 // Clean static call (will force resolving on next use) |
373 // Clean static call (will force resolving on next use) |
372 virtual address destination() const = 0; |
374 virtual address destination() const = 0; |
373 |
375 |
374 // Clean static call (will force resolving on next use) |
376 // Clean static call (will force resolving on next use) |
375 void set_to_clean(bool in_use = true); |
377 bool set_to_clean(bool in_use = true); |
376 |
378 |
377 // Set state. The entry must be the same, as computed by compute_entry. |
379 // Set state. The entry must be the same, as computed by compute_entry. |
378 // Computation and setting is split up, since the actions are separate during |
380 // Computation and setting is split up, since the actions are separate during |
379 // a OptoRuntime::resolve_xxx. |
381 // a OptoRuntime::resolve_xxx. |
380 void set(const StaticCallInfo& info); |
382 void set(const StaticCallInfo& info); |