hotspot/src/share/vm/asm/assembler.hpp
changeset 46272 3cee5c1f3459
parent 40093 f94d179a730b
--- a/hotspot/src/share/vm/asm/assembler.hpp	Wed Feb 15 22:59:57 2017 -0500
+++ b/hotspot/src/share/vm/asm/assembler.hpp	Fri Jan 27 10:22:19 2017 +0100
@@ -93,6 +93,10 @@
   GrowableArray<int>* _patch_overflow;
 
   Label(const Label&) { ShouldNotReachHere(); }
+ protected:
+
+  // The label will be bound to a location near its users.
+  bool _is_near;
 
  public:
 
@@ -126,6 +130,10 @@
   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
@@ -145,6 +153,7 @@
     _loc = -1;
     _patch_index = 0;
     _patch_overflow = NULL;
+    _is_near = false;
   }
 
   Label() {
@@ -152,6 +161,13 @@
   }
 };
 
+// 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.