1472N/A * or visit www.oracle.com if you need additional information or have any
1879N/A#ifndef SHARE_VM_CODE_STUBS_HPP
4016N/A#include "asm/codeBuffer.hpp"
1879N/A#include "memory/allocation.hpp"
1879N/A# include "os_linux.inline.hpp"
1879N/A# include "os_solaris.inline.hpp"
1879N/A# include "os_windows.inline.hpp"
2796N/A#ifdef TARGET_OS_FAMILY_bsd
2796N/A# include "os_bsd.inline.hpp"
4332N/A CodeStrings& strings) { ShouldNotCallThis(); } // called to initialize/specify the stub's size
0N/A // General info/converters
0N/A int size() const { ShouldNotCallThis(); return 0; } // must return the size provided by initialize
0N/A static int code_size_to_size(int code_size) { ShouldNotCallThis(); return 0; } // computes the size given the code size
0N/A address code_begin() const { ShouldNotCallThis(); return NULL; } // points to the first byte of the code
0N/A address code_end() const { ShouldNotCallThis(); return NULL; } // points to the first byte after the code
4332N/A CodeStrings& strings) = 0; // called after creation (called twice if allocated via (request, commit))
0N/A // General info/converters
0N/A virtual int size(Stub* self) const = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment)
0N/A virtual int code_size_to_size(int code_size) const = 0; // computes the total stub size in bytes given the code size in bytes
0N/A /* Initialization/finalization */ \
0N/A virtual int code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \
0N/A int _buffer_limit; // the (byte) index of the actual buffer limit (_buffer_limit <= _buffer_size)
0N/A void check_index(int i) const { assert(0 <= i && i < _buffer_limit && i % CodeEntryAlignment == 0, "illegal index"); }
4332N/A CodeStrings& strings) { assert(size % CodeEntryAlignment == 0, "size not aligned"); _stub_interface->initialize(s, size, strings); }
0N/A bool stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); }
0N/A int stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); }
0N/A int available_space() const { int d = _queue_begin - _queue_end - 1; return d < 0 ? d + _buffer_size : d; }
0N/A bool contains(address pc) const { return _stub_buffer <= pc && pc < _stub_buffer + _buffer_limit; }
0N/A Stub* request_committed(int code_size); // request a stub that provides exactly code_size space for code
0N/A Stub* request(int requested_code_size); // request a stub with a (maximum) code space - locks the queue
0N/A if (i == _buffer_limit) i = 0;