131 ~CompiledICInfo() {
132 // In rare cases the info is computed but not used, so release any
133 // CompiledICHolder* that was created
134 if (_release_icholder) {
135 assert(_is_icholder, "must be");
136 CompiledICHolder* icholder = (CompiledICHolder*)_cached_value;
137 icholder->claim();
138 delete icholder;
139 }
140 }
141 };
142
143 class NativeCallWrapper: public ResourceObj {
144 public:
145 virtual address destination() const = 0;
146 virtual address instruction_address() const = 0;
147 virtual address next_instruction_address() const = 0;
148 virtual address return_address() const = 0;
149 virtual address get_resolve_call_stub(bool is_optimized) const = 0;
150 virtual void set_destination_mt_safe(address dest) = 0;
151 virtual void set_to_interpreted(methodHandle method, CompiledICInfo& info) = 0;
152 virtual void verify() const = 0;
153 virtual void verify_resolve_call(address dest) const = 0;
154
155 virtual bool is_call_to_interpreted(address dest) const = 0;
156 virtual bool is_safe_for_patching() const = 0;
157
158 virtual NativeInstruction* get_load_instruction(virtual_call_Relocation* r) const = 0;
159
160 virtual void *get_data(NativeInstruction* instruction) const = 0;
161 virtual void set_data(NativeInstruction* instruction, intptr_t data) = 0;
162 };
163
164 class CompiledIC: public ResourceObj {
165 friend class InlineCacheBuffer;
166 friend class ICStub;
167
168 private:
169 NativeCallWrapper* _call;
170 NativeInstruction* _value; // patchable value cell for this IC
171 bool _is_optimized; // an optimized virtual call (i.e., no compiled IC)
357 virtual address destination() const = 0;
358
359 // Clean static call (will force resolving on next use)
360 void set_to_clean();
361
362 // Set state. The entry must be the same, as computed by compute_entry.
363 // Computation and setting is split up, since the actions are separate during
364 // a OptoRuntime::resolve_xxx.
365 void set(const StaticCallInfo& info);
366
367 // State
368 bool is_clean() const;
369 bool is_call_to_compiled() const;
370 virtual bool is_call_to_interpreted() const = 0;
371
372 virtual address instruction_address() const = 0;
373 protected:
374 virtual address resolve_call_stub() const = 0;
375 virtual void set_destination_mt_safe(address dest) = 0;
376 #if INCLUDE_AOT
377 virtual void set_to_far(methodHandle callee, address entry) = 0;
378 #endif
379 virtual void set_to_interpreted(methodHandle callee, address entry) = 0;
380 virtual const char* name() const = 0;
381
382 void set_to_compiled(address entry);
383 };
384
385 class CompiledDirectStaticCall : public CompiledStaticCall {
386 private:
387 friend class CompiledIC;
388 friend class DirectNativeCallWrapper;
389
390 // Also used by CompiledIC
391 void set_to_interpreted(methodHandle callee, address entry);
392 #if INCLUDE_AOT
393 void set_to_far(methodHandle callee, address entry);
394 #endif
395 address instruction_address() const { return _call->instruction_address(); }
396 void set_destination_mt_safe(address dest) { _call->set_destination_mt_safe(dest); }
397
398 NativeCall* _call;
399
400 CompiledDirectStaticCall(NativeCall* call) : _call(call) {}
401
402 public:
403 static inline CompiledDirectStaticCall* before(address return_addr) {
404 CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_before(return_addr));
405 st->verify();
406 return st;
407 }
408
409 static inline CompiledDirectStaticCall* at(address native_call) {
410 CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_at(native_call));
411 st->verify();
412 return st;
413 }
|
131 ~CompiledICInfo() {
132 // In rare cases the info is computed but not used, so release any
133 // CompiledICHolder* that was created
134 if (_release_icholder) {
135 assert(_is_icholder, "must be");
136 CompiledICHolder* icholder = (CompiledICHolder*)_cached_value;
137 icholder->claim();
138 delete icholder;
139 }
140 }
141 };
142
143 class NativeCallWrapper: public ResourceObj {
144 public:
145 virtual address destination() const = 0;
146 virtual address instruction_address() const = 0;
147 virtual address next_instruction_address() const = 0;
148 virtual address return_address() const = 0;
149 virtual address get_resolve_call_stub(bool is_optimized) const = 0;
150 virtual void set_destination_mt_safe(address dest) = 0;
151 virtual void set_to_interpreted(const methodHandle& method, CompiledICInfo& info) = 0;
152 virtual void verify() const = 0;
153 virtual void verify_resolve_call(address dest) const = 0;
154
155 virtual bool is_call_to_interpreted(address dest) const = 0;
156 virtual bool is_safe_for_patching() const = 0;
157
158 virtual NativeInstruction* get_load_instruction(virtual_call_Relocation* r) const = 0;
159
160 virtual void *get_data(NativeInstruction* instruction) const = 0;
161 virtual void set_data(NativeInstruction* instruction, intptr_t data) = 0;
162 };
163
164 class CompiledIC: public ResourceObj {
165 friend class InlineCacheBuffer;
166 friend class ICStub;
167
168 private:
169 NativeCallWrapper* _call;
170 NativeInstruction* _value; // patchable value cell for this IC
171 bool _is_optimized; // an optimized virtual call (i.e., no compiled IC)
357 virtual address destination() const = 0;
358
359 // Clean static call (will force resolving on next use)
360 void set_to_clean();
361
362 // Set state. The entry must be the same, as computed by compute_entry.
363 // Computation and setting is split up, since the actions are separate during
364 // a OptoRuntime::resolve_xxx.
365 void set(const StaticCallInfo& info);
366
367 // State
368 bool is_clean() const;
369 bool is_call_to_compiled() const;
370 virtual bool is_call_to_interpreted() const = 0;
371
372 virtual address instruction_address() const = 0;
373 protected:
374 virtual address resolve_call_stub() const = 0;
375 virtual void set_destination_mt_safe(address dest) = 0;
376 #if INCLUDE_AOT
377 virtual void set_to_far(const methodHandle& callee, address entry) = 0;
378 #endif
379 virtual void set_to_interpreted(const methodHandle& callee, address entry) = 0;
380 virtual const char* name() const = 0;
381
382 void set_to_compiled(address entry);
383 };
384
385 class CompiledDirectStaticCall : public CompiledStaticCall {
386 private:
387 friend class CompiledIC;
388 friend class DirectNativeCallWrapper;
389
390 // Also used by CompiledIC
391 void set_to_interpreted(const methodHandle& callee, address entry);
392 #if INCLUDE_AOT
393 void set_to_far(const methodHandle& callee, address entry);
394 #endif
395 address instruction_address() const { return _call->instruction_address(); }
396 void set_destination_mt_safe(address dest) { _call->set_destination_mt_safe(dest); }
397
398 NativeCall* _call;
399
400 CompiledDirectStaticCall(NativeCall* call) : _call(call) {}
401
402 public:
403 static inline CompiledDirectStaticCall* before(address return_addr) {
404 CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_before(return_addr));
405 st->verify();
406 return st;
407 }
408
409 static inline CompiledDirectStaticCall* at(address native_call) {
410 CompiledDirectStaticCall* st = new CompiledDirectStaticCall(nativeCall_at(native_call));
411 st->verify();
412 return st;
413 }
|