< prev index next >
src/share/vm/asm/assembler.hpp
Print this page
rev 12485 : 8173465: Introduce NearLabel for branches known to be short.
*** 91,100 ****
--- 91,104 ----
int _patches[PatchCacheSize];
int _patch_index;
GrowableArray<int>* _patch_overflow;
Label(const Label&) { ShouldNotReachHere(); }
+ protected:
+
+ // The label will be bound to a location near its users.
+ unsigned int _is_near:1;
public:
/**
* After binding, be sure 'patch_instructions' is called later to link
*** 124,133 ****
--- 128,141 ----
bool is_bound() const { return _loc >= 0; }
bool is_unbound() const { return _loc == -1 && _patch_index > 0; }
bool is_unused() const { return _loc == -1 && _patch_index == 0; }
+ // The label will be bound to a location near its users. Users can
+ // optimize on this information, e.g. generate short branches.
+ bool is_near() { return _is_near; }
+
/**
* Adds a reference to an unresolved displacement instruction to
* this unbound label
*
* @param cb the code buffer being patched
*** 143,159 ****
--- 151,175 ----
void init() {
_loc = -1;
_patch_index = 0;
_patch_overflow = NULL;
+ _is_near = false;
}
Label() {
init();
}
};
+ // A NearLabel must be bound to a location near its users. Users can
+ // optimize on this information, e.g. generate short branches.
+ class NearLabel : public Label {
+ public:
+ NearLabel() : Label() { _is_near = true; }
+ };
+
// A union type for code which has to assemble both constant and
// non-constant operands, when the distinction cannot be made
// statically.
class RegisterOrConstant VALUE_OBJ_CLASS_SPEC {
private:
< prev index next >