6978355: renaming for 6961697
authortwisti
Wed, 25 Aug 2010 05:27:54 -0700
changeset 6418 6671edbd230e
parent 6417 82e8f98f22d8
child 6419 6b7a06ace8ab
6978355: renaming for 6961697 Summary: This is the renaming part of 6961697 to keep the actual changes small for review. Reviewed-by: kvn, never
hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/c1/Runtime1.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/code/PCDesc.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java
hotspot/src/cpu/sparc/vm/assembler_sparc.cpp
hotspot/src/cpu/sparc/vm/codeBuffer_sparc.hpp
hotspot/src/cpu/sparc/vm/frame_sparc.cpp
hotspot/src/cpu/sparc/vm/jniFastGetField_sparc.cpp
hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
hotspot/src/cpu/sparc/vm/sparc.ad
hotspot/src/cpu/x86/vm/frame_x86.cpp
hotspot/src/cpu/x86/vm/frame_x86.inline.hpp
hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp
hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
hotspot/src/cpu/x86/vm/vm_version_x86.cpp
hotspot/src/cpu/x86/vm/x86_32.ad
hotspot/src/cpu/x86/vm/x86_64.ad
hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp
hotspot/src/os/solaris/dtrace/libjvm_db.c
hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
hotspot/src/os_cpu/windows_x86/vm/windows_x86_32.ad
hotspot/src/os_cpu/windows_x86/vm/windows_x86_64.ad
hotspot/src/share/vm/adlc/output_c.cpp
hotspot/src/share/vm/asm/codeBuffer.cpp
hotspot/src/share/vm/asm/codeBuffer.hpp
hotspot/src/share/vm/c1/c1_Compilation.cpp
hotspot/src/share/vm/c1/c1_Runtime1.cpp
hotspot/src/share/vm/c1/c1_Runtime1.hpp
hotspot/src/share/vm/ci/ciMethod.cpp
hotspot/src/share/vm/code/codeBlob.cpp
hotspot/src/share/vm/code/codeBlob.hpp
hotspot/src/share/vm/code/codeCache.cpp
hotspot/src/share/vm/code/exceptionHandlerTable.cpp
hotspot/src/share/vm/code/nmethod.cpp
hotspot/src/share/vm/code/nmethod.hpp
hotspot/src/share/vm/code/pcDesc.cpp
hotspot/src/share/vm/code/relocInfo.cpp
hotspot/src/share/vm/code/scopeDesc.cpp
hotspot/src/share/vm/code/stubs.cpp
hotspot/src/share/vm/code/vtableStubs.cpp
hotspot/src/share/vm/compiler/compileBroker.cpp
hotspot/src/share/vm/compiler/disassembler.cpp
hotspot/src/share/vm/interpreter/interpreter.hpp
hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
hotspot/src/share/vm/opto/compile.cpp
hotspot/src/share/vm/opto/graphKit.cpp
hotspot/src/share/vm/opto/lcm.cpp
hotspot/src/share/vm/opto/library_call.cpp
hotspot/src/share/vm/opto/output.cpp
hotspot/src/share/vm/opto/stringopts.cpp
hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp
hotspot/src/share/vm/prims/jvmtiExport.cpp
hotspot/src/share/vm/prims/methodHandles.cpp
hotspot/src/share/vm/runtime/compilationPolicy.cpp
hotspot/src/share/vm/runtime/frame.cpp
hotspot/src/share/vm/runtime/icache.cpp
hotspot/src/share/vm/runtime/rframe.cpp
hotspot/src/share/vm/runtime/sharedRuntime.cpp
hotspot/src/share/vm/runtime/sharedRuntime.hpp
hotspot/src/share/vm/runtime/stubRoutines.cpp
hotspot/src/share/vm/runtime/vmStructs.cpp
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java	Wed Aug 25 05:27:54 2010 -0700
@@ -1037,7 +1037,7 @@
                             public void prologue(Address start, Address end) {
                             }
                             public void visit(CodeBlob blob) {
-                                fout.println(gen.genHTML(blob.instructionsBegin()));
+                                fout.println(gen.genHTML(blob.contentBegin()));
                             }
                             public void epilogue() {
                             }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/c1/Runtime1.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/c1/Runtime1.java	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
 
   /** FIXME: consider making argument "type-safe" in Java port */
   public Address entryFor(int id) {
-    return blobFor(id).instructionsBegin();
+    return blobFor(id).codeBegin();
   }
 
   /** FIXME: consider making argument "type-safe" in Java port */
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,8 @@
   private static CIntegerField sizeField;
   private static CIntegerField headerSizeField;
   private static CIntegerField relocationSizeField;
-  private static CIntegerField instructionsOffsetField;
+  private static CIntegerField contentOffsetField;
+  private static CIntegerField codeOffsetField;
   private static CIntegerField frameCompleteOffsetField;
   private static CIntegerField dataOffsetField;
   private static CIntegerField frameSizeField;
@@ -68,7 +69,8 @@
     headerSizeField          = type.getCIntegerField("_header_size");
     relocationSizeField      = type.getCIntegerField("_relocation_size");
     frameCompleteOffsetField = type.getCIntegerField("_frame_complete_offset");
-    instructionsOffsetField  = type.getCIntegerField("_instructions_offset");
+    contentOffsetField       = type.getCIntegerField("_content_offset");
+    codeOffsetField          = type.getCIntegerField("_code_offset");
     dataOffsetField          = type.getCIntegerField("_data_offset");
     frameSizeField           = type.getCIntegerField("_frame_size");
     oopMapsField             = type.getAddressField("_oop_maps");
@@ -111,11 +113,19 @@
   //  public RelocInfo relocationBegin();
   //  public RelocInfo relocationEnd();
 
-  public Address instructionsBegin() {
-    return headerBegin().addOffsetTo(instructionsOffsetField.getValue(addr));
+  public Address contentBegin() {
+    return headerBegin().addOffsetTo(contentOffsetField.getValue(addr));
   }
 
-  public Address instructionsEnd() {
+  public Address contentEnd() {
+    return headerBegin().addOffsetTo(dataOffsetField.getValue(addr));
+  }
+
+  public Address codeBegin() {
+    return headerBegin().addOffsetTo(contentOffsetField.getValue(addr));
+  }
+
+  public Address codeEnd() {
     return headerBegin().addOffsetTo(dataOffsetField.getValue(addr));
   }
 
@@ -128,24 +138,27 @@
   }
 
   // Offsets
-  public int getRelocationOffset()   { return (int) headerSizeField.getValue(addr);         }
-  public int getInstructionsOffset() { return (int) instructionsOffsetField.getValue(addr); }
-  public int getDataOffset()         { return (int) dataOffsetField.getValue(addr);         }
+  public int getRelocationOffset() { return (int) headerSizeField   .getValue(addr); }
+  public int getContentOffset()    { return (int) contentOffsetField.getValue(addr); }
+  public int getCodeOffset()       { return (int) codeOffsetField   .getValue(addr); }
+  public int getDataOffset()       { return (int) dataOffsetField   .getValue(addr); }
 
   // Sizes
-  public int getSize()             { return (int) sizeField.getValue(addr);                     }
-  public int getHeaderSize()       { return (int) headerSizeField.getValue(addr);               }
+  public int getSize()             { return (int) sizeField      .getValue(addr);     }
+  public int getHeaderSize()       { return (int) headerSizeField.getValue(addr);     }
   // FIXME: add getRelocationSize()
-  public int getInstructionsSize() { return (int) instructionsEnd().minus(instructionsBegin()); }
-  public int getDataSize()         { return (int) dataEnd().minus(dataBegin());                 }
+  public int getContentSize()      { return (int) contentEnd().minus(contentBegin()); }
+  public int getCodeSize()         { return (int) codeEnd()   .minus(codeBegin());    }
+  public int getDataSize()         { return (int) dataEnd()   .minus(dataBegin());    }
 
   // Containment
-  public boolean blobContains(Address addr)         { return headerBegin().lessThanOrEqual(addr) && dataEnd().greaterThan(addr);               }
+  public boolean blobContains(Address addr)    { return headerBegin() .lessThanOrEqual(addr) && dataEnd()   .greaterThan(addr); }
   // FIXME: add relocationContains
-  public boolean instructionsContains(Address addr) { return instructionsBegin().lessThanOrEqual(addr) && instructionsEnd().greaterThan(addr); }
-  public boolean dataContains(Address addr)         { return dataBegin().lessThanOrEqual(addr) && dataEnd().greaterThan(addr);                 }
-  public boolean contains(Address addr)             { return instructionsContains(addr);                                                       }
-  public boolean isFrameCompleteAt(Address a)       { return instructionsContains(a) && a.minus(instructionsBegin()) >= frameCompleteOffsetField.getValue(addr); }
+  public boolean contentContains(Address addr) { return contentBegin().lessThanOrEqual(addr) && contentEnd().greaterThan(addr); }
+  public boolean codeContains(Address addr)    { return codeBegin()   .lessThanOrEqual(addr) && codeEnd()   .greaterThan(addr); }
+  public boolean dataContains(Address addr)    { return dataBegin()   .lessThanOrEqual(addr) && dataEnd()   .greaterThan(addr); }
+  public boolean contains(Address addr)        { return contentContains(addr);                                                  }
+  public boolean isFrameCompleteAt(Address a)  { return codeContains(a) && a.minus(codeBegin()) >= frameCompleteOffsetField.getValue(addr); }
 
   // Reclamation support (really only used by the nmethods, but in order to get asserts to work
   // in the CodeCache they are defined virtual here)
@@ -168,7 +181,7 @@
     if (Assert.ASSERTS_ENABLED) {
       Assert.that(getOopMaps() != null, "nope");
     }
-    return getOopMaps().findMapAtOffset(pc.minus(instructionsBegin()), debugging);
+    return getOopMaps().findMapAtOffset(pc.minus(codeBegin()), debugging);
   }
 
   //  virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, void f(oop*)) { ShouldNotReachHere(); }
@@ -200,7 +213,8 @@
   }
 
   protected void printComponentsOn(PrintStream tty) {
-    tty.println(" instructions: [" + instructionsBegin() + ", " + instructionsEnd() + "), " +
+    tty.println(" content: [" + contentBegin() + ", " + contentEnd() + "), " +
+                " code: [" + codeBegin() + ", " + codeEnd() + "), " +
                 " data: [" + dataBegin() + ", " + dataEnd() + "), " +
                 " frame size: " + getFrameSize());
   }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java	Wed Aug 25 05:27:54 2010 -0700
@@ -134,10 +134,10 @@
   public boolean isOSRMethod()    { return getEntryBCI() != VM.getVM().getInvocationEntryBCI(); }
 
   /** Boundaries for different parts */
-  public Address constantsBegin()       { return instructionsBegin();                                }
+  public Address constantsBegin()       { return contentBegin();                                     }
   public Address constantsEnd()         { return getEntryPoint();                                    }
-  public Address codeBegin()            { return getEntryPoint();                                    }
-  public Address codeEnd()              { return headerBegin().addOffsetTo(getStubOffset());         }
+  public Address instsBegin()           { return codeBegin();                                       }
+  public Address instsEnd()             { return headerBegin().addOffsetTo(getStubOffset());         }
   public Address exceptionBegin()       { return headerBegin().addOffsetTo(getExceptionOffset());    }
   public Address deoptBegin()           { return headerBegin().addOffsetTo(getDeoptOffset());        }
   public Address stubBegin()            { return headerBegin().addOffsetTo(getStubOffset());         }
@@ -156,7 +156,7 @@
   public Address nulChkTableEnd()       { return headerBegin().addOffsetTo(getNMethodEndOffset());   }
 
   public int constantsSize()            { return (int) constantsEnd()   .minus(constantsBegin());    }
-  public int codeSize()                 { return (int) codeEnd()        .minus(codeBegin());         }
+  public int instsSize()                { return (int) instsEnd()       .minus(instsBegin());        }
   public int stubSize()                 { return (int) stubEnd()        .minus(stubBegin());         }
   public int oopsSize()                 { return (int) oopsEnd()        .minus(oopsBegin());         }
   public int scopesDataSize()           { return (int) scopesDataEnd()  .minus(scopesDataBegin());   }
@@ -169,7 +169,7 @@
   public int totalSize() {
     return
       constantsSize()    +
-      codeSize()         +
+      instsSize()        +
       stubSize()         +
       scopesDataSize()   +
       scopesPCsSize()    +
@@ -179,7 +179,7 @@
   }
 
   public boolean constantsContains   (Address addr) { return constantsBegin()   .lessThanOrEqual(addr) && constantsEnd()   .greaterThan(addr); }
-  public boolean codeContains        (Address addr) { return codeBegin()        .lessThanOrEqual(addr) && codeEnd()        .greaterThan(addr); }
+  public boolean instsContains       (Address addr) { return instsBegin()       .lessThanOrEqual(addr) && instsEnd()       .greaterThan(addr); }
   public boolean stubContains        (Address addr) { return stubBegin()        .lessThanOrEqual(addr) && stubEnd()        .greaterThan(addr); }
   public boolean oopsContains        (Address addr) { return oopsBegin()        .lessThanOrEqual(addr) && oopsEnd()        .greaterThan(addr); }
   public boolean scopesDataContains  (Address addr) { return scopesDataBegin()  .lessThanOrEqual(addr) && scopesDataEnd()  .greaterThan(addr); }
@@ -353,7 +353,8 @@
 
   protected void printComponentsOn(PrintStream tty) {
     // FIXME: add relocation information
-    tty.println(" instructions: [" + instructionsBegin() + ", " + instructionsEnd() + "), " +
+    tty.println(" content: [" + contentBegin() + ", " + contentEnd() + "), " +
+                " code: [" + codeBegin() + ", " + codeEnd() + "), " +
                 " data: [" + dataBegin() + ", " + dataEnd() + "), " +
                 " oops: [" + oopsBegin() + ", " + oopsEnd() + "), " +
                 " frame size: " + getFrameSize());
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/PCDesc.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/PCDesc.java	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
   }
 
   public Address getRealPC(NMethod code) {
-    return code.instructionsBegin().addOffsetTo(getPCOffset());
+    return code.codeBegin().addOffsetTo(getPCOffset());
   }
 
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -190,11 +190,11 @@
 
   private void reportResult(StringBuffer result, CodeBlob blob) {
     result.append("<a href='blob:");
-    result.append(blob.instructionsBegin().toString());
+    result.append(blob.contentBegin().toString());
     result.append("'>");
     result.append(blob.getName());
     result.append("@");
-    result.append(blob.instructionsBegin());
+    result.append(blob.contentBegin());
     result.append("</a><br>");
   }
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Wed Aug 25 05:27:54 2010 -0700
@@ -1415,13 +1415,13 @@
          buf.append(genMethodAndKlassLink(nmethod.getMethod()));
 
          buf.h3("Compiled Code");
-         sun.jvm.hotspot.debugger.Address codeBegin = nmethod.codeBegin();
-         sun.jvm.hotspot.debugger.Address codeEnd   = nmethod.codeEnd();
-         final int codeSize = (int)codeEnd.minus(codeBegin);
-         final long startPc = addressToLong(codeBegin);
-         final byte[] code = new byte[codeSize];
+         sun.jvm.hotspot.debugger.Address instsBegin = nmethod.instsBegin();
+         sun.jvm.hotspot.debugger.Address instsEnd   = nmethod.instsEnd();
+         final int instsSize = nmethod.instsSize();
+         final long startPc = addressToLong(instsBegin);
+         final byte[] code = new byte[instsSize];
          for (int i=0; i < code.length; i++)
-            code[i] = codeBegin.getJByteAt(i);
+            code[i] = instsBegin.getJByteAt(i);
 
          final long verifiedEntryPoint = addressToLong(nmethod.getVerifiedEntryPoint());
          final long entryPoint = addressToLong(nmethod.getEntryPoint());
@@ -1499,8 +1499,8 @@
          buf.h3("CodeBlob");
 
          buf.h3("Compiled Code");
-         final sun.jvm.hotspot.debugger.Address codeBegin = blob.instructionsBegin();
-         final int codeSize = blob.getInstructionsSize();
+         final sun.jvm.hotspot.debugger.Address codeBegin = blob.codeBegin();
+         final int codeSize = blob.getCodeSize();
          final long startPc = addressToLong(codeBegin);
          final byte[] code = new byte[codeSize];
          for (int i=0; i < code.length; i++)
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java	Wed Aug 25 05:27:54 2010 -0700
@@ -96,15 +96,15 @@
         if (Assert.ASSERTS_ENABLED) {
           Assert.that(loc.blob != null, "Should have found CodeBlob");
         }
-        loc.inBlobInstructions = loc.blob.instructionsContains(a);
-        loc.inBlobData         = loc.blob.dataContains(a);
+        loc.inBlobCode = loc.blob.codeContains(a);
+        loc.inBlobData = loc.blob.dataContains(a);
 
         if (loc.blob.isNMethod()) {
             NMethod nm = (NMethod) loc.blob;
             loc.inBlobOops = nm.oopsContains(a);
         }
 
-        loc.inBlobUnknownLocation = (!(loc.inBlobInstructions ||
+        loc.inBlobUnknownLocation = (!(loc.inBlobCode ||
                                        loc.inBlobData ||
                                        loc.inBlobOops));
         return loc;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
   InterpreterCodelet interpreterCodelet;
   CodeBlob blob;
   // FIXME: add more detail about CodeBlob
-  boolean inBlobInstructions;
+  boolean inBlobCode;
   boolean inBlobData;
   boolean inBlobOops;
   boolean inBlobUnknownLocation;
@@ -142,8 +142,8 @@
     return blob;
   }
 
-  public boolean isInBlobInstructions() {
-    return inBlobInstructions;
+  public boolean isInBlobCode() {
+    return inBlobCode;
   }
 
   public boolean isInBlobData() {
@@ -233,8 +233,8 @@
     } else if (isInCodeCache()) {
       CodeBlob b = getCodeBlob();
       tty.print("In ");
-      if (isInBlobInstructions()) {
-        tty.print("instructions");
+      if (isInBlobCode()) {
+        tty.print("code");
       } else if (isInBlobData()) {
         tty.print("data");
       } else if (isInBlobOops()) {
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -4192,7 +4192,7 @@
 
 static void generate_satb_log_enqueue(bool with_frame) {
   BufferBlob* bb = BufferBlob::create("enqueue_with_frame", EnqueueCodeSize);
-  CodeBuffer buf(bb->instructions_begin(), bb->instructions_size());
+  CodeBuffer buf(bb);
   MacroAssembler masm(&buf);
   address start = masm.pc();
   Register pre_val;
@@ -4421,7 +4421,7 @@
 // This gets to assume that o0 contains the object address.
 static void generate_dirty_card_log_enqueue(jbyte* byte_map_base) {
   BufferBlob* bb = BufferBlob::create("dirty_card_enqueue", EnqueueCodeSize*2);
-  CodeBuffer buf(bb->instructions_begin(), bb->instructions_size());
+  CodeBuffer buf(bb);
   MacroAssembler masm(&buf);
   address start = masm.pc();
 
--- a/hotspot/src/cpu/sparc/vm/codeBuffer_sparc.hpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/codeBuffer_sparc.hpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,5 +30,5 @@
 
   // Heuristic for pre-packing the pt/pn bit of a predicted branch.
   bool is_backward_branch(Label& L) {
-    return L.is_bound() && code_end() <= locator_address(L.loc());
+    return L.is_bound() && insts_end() <= locator_address(L.loc());
   }
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -253,11 +253,12 @@
     }
 
     // Could just be some random pointer within the codeBlob
-    if (!sender.cb()->instructions_contains(sender_pc)) return false;
+    if (!sender.cb()->code_contains(sender_pc)) {
+      return false;
+    }
 
     // We should never be able to see an adapter if the current frame is something from code cache
-
-    if ( sender_blob->is_adapter_blob()) {
+    if (sender_blob->is_adapter_blob()) {
       return false;
     }
 
--- a/hotspot/src/cpu/sparc/vm/jniFastGetField_sparc.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/jniFastGetField_sparc.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,10 +50,10 @@
     default:        ShouldNotReachHere();
   }
   ResourceMark rm;
-  BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
-  address fast_entry = b->instructions_begin();
-  CodeBuffer cbuf(fast_entry, b->instructions_size());
+  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+  CodeBuffer cbuf(blob);
   MacroAssembler* masm = new MacroAssembler(&cbuf);
+  address fast_entry = __ pc();
 
   Label label1, label2;
 
@@ -129,10 +129,10 @@
 address JNI_FastGetField::generate_fast_get_long_field() {
   const char *name = "jni_fast_GetLongField";
   ResourceMark rm;
-  BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
-  address fast_entry = b->instructions_begin();
-  CodeBuffer cbuf(fast_entry, b->instructions_size());
+  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+  CodeBuffer cbuf(blob);
   MacroAssembler* masm = new MacroAssembler(&cbuf);
+  address fast_entry = __ pc();
 
   Label label1, label2;
 
@@ -201,10 +201,10 @@
     default:       ShouldNotReachHere();
   }
   ResourceMark rm;
-  BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
-  address fast_entry = b->instructions_begin();
-  CodeBuffer cbuf(fast_entry, b->instructions_size());
+  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+  CodeBuffer cbuf(blob);
   MacroAssembler* masm = new MacroAssembler(&cbuf);
+  address fast_entry = __ pc();
 
   Label label1, label2;
 
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -193,17 +193,17 @@
 
   a->call( a->pc(), relocInfo::none );
   a->delayed()->nop();
-  nc = nativeCall_at( cb.code_begin() );
+  nc = nativeCall_at( cb.insts_begin() );
   nc->print();
 
   nc = nativeCall_overwriting_at( nc->next_instruction_address() );
   for (idx = 0; idx < ARRAY_SIZE(offsets); idx++) {
-    nc->set_destination( cb.code_begin() + offsets[idx] );
-    assert(nc->destination() == (cb.code_begin() + offsets[idx]), "check unit test");
+    nc->set_destination( cb.insts_begin() + offsets[idx] );
+    assert(nc->destination() == (cb.insts_begin() + offsets[idx]), "check unit test");
     nc->print();
   }
 
-  nc = nativeCall_before( cb.code_begin() + 8 );
+  nc = nativeCall_before( cb.insts_begin() + 8 );
   nc->print();
 
   VM_Version::revert();
@@ -368,7 +368,7 @@
   a->sethi(al2, O2);
   a->add(O2, al2.low10(), O2);
 
-  nm = nativeMovConstReg_at( cb.code_begin() );
+  nm = nativeMovConstReg_at( cb.insts_begin() );
   nm->print();
 
   nm = nativeMovConstReg_at( nm->next_instruction_address() );
@@ -480,7 +480,7 @@
   a->nop();
   a->add(O2, al2.low10(), O2);
 
-  nm = nativeMovConstRegPatching_at( cb.code_begin() );
+  nm = nativeMovConstRegPatching_at( cb.insts_begin() );
   nm->print();
 
   nm = nativeMovConstRegPatching_at( nm->next_instruction_address() );
@@ -616,7 +616,7 @@
   a->sethi(al2, I3); a->add(I3, al2.low10(), I3);
   a->stf( FloatRegisterImpl::S, F15, O0, I3 ); idx++;
 
-  nm = nativeMovRegMem_at( cb.code_begin() );
+  nm = nativeMovRegMem_at( cb.insts_begin() );
   nm->print();
   nm->set_offset( low10(0) );
   nm->print();
@@ -760,7 +760,7 @@
   a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
   a->stf( FloatRegisterImpl::S, F15, O0, I3 ); idx++;
 
-  nm = nativeMovRegMemPatching_at( cb.code_begin() );
+  nm = nativeMovRegMemPatching_at( cb.insts_begin() );
   nm->print();
   nm->set_offset( low10(0) );
   nm->print();
@@ -849,7 +849,7 @@
   a->jmpl(I3, al.low10(), L3, RelocationHolder::none);
   a->delayed()->nop();
 
-  nj = nativeJump_at( cb.code_begin() );
+  nj = nativeJump_at( cb.insts_begin() );
   nj->print();
 
   nj = nativeJump_at( nj->next_instruction_address() );
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Wed Aug 25 05:27:54 2010 -0700
@@ -677,8 +677,7 @@
            (f20 << 20) |
            (f19 << 19) |
            (f0  <<  0);
-  *((int*)(cbuf.code_end())) = op;
-  cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+  cbuf.insts()->emit_int32(op);
 }
 
 // Standard Sparc opcode form2 field breakdown
@@ -689,8 +688,7 @@
            (f25 << 25) |
            (f22 << 22) |
            (f0  <<  0);
-  *((int*)(cbuf.code_end())) = op;
-  cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+  cbuf.insts()->emit_int32(op);
 }
 
 // Standard Sparc opcode form3 field breakdown
@@ -701,8 +699,7 @@
            (f14 << 14) |
            (f5  <<  5) |
            (f0  <<  0);
-  *((int*)(cbuf.code_end())) = op;
-  cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+  cbuf.insts()->emit_int32(op);
 }
 
 // Standard Sparc opcode form3 field breakdown
@@ -714,8 +711,7 @@
            (f14 << 14) |
            (1   << 13) | // bit to indicate immediate-mode
            (simm13<<0);
-  *((int*)(cbuf.code_end())) = op;
-  cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+  cbuf.insts()->emit_int32(op);
 }
 
 static inline void emit3_simm10(CodeBuffer &cbuf, int f30, int f25, int f19, int f14, int simm10 ) {
@@ -910,9 +906,7 @@
     instr |= disp & 0x1FFF;
   }
 
-  uint *code = (uint*)cbuf.code_end();
-  *code = instr;
-  cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+  cbuf.insts()->emit_int32(instr);
 
 #ifdef ASSERT
   {
@@ -1532,7 +1526,7 @@
   // set (empty), G5
   // jmp -1
 
-  address mark = cbuf.inst_mark();  // get mark within main instrs section
+  address mark = cbuf.insts_mark();  // get mark within main instrs section
 
   MacroAssembler _masm(&cbuf);
 
@@ -1632,7 +1626,7 @@
 // Emit exception handler code.
 int emit_exception_handler(CodeBuffer& cbuf) {
   Register temp_reg = G3;
-  AddressLiteral exception_blob(OptoRuntime::exception_blob()->instructions_begin());
+  AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point());
   MacroAssembler _masm(&cbuf);
 
   address base =
@@ -2292,8 +2286,7 @@
              (0 << 13) |                    // select register move
              ($pcc$$constant << 11) |       // cc1, cc0 bits for 'icc' or 'xcc'
              ($src$$reg << 0);
-    *((int*)(cbuf.code_end())) = op;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32(op);
   %}
 
   enc_class enc_cmov_imm( cmpOp cmp, iRegI dst, immI11 src, immI pcc ) %{
@@ -2306,8 +2299,7 @@
              (1 << 13) |                    // select immediate move
              ($pcc$$constant << 11) |       // cc1, cc0 bits for 'icc'
              (simm11 << 0);
-    *((int*)(cbuf.code_end())) = op;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32(op);
   %}
 
   enc_class enc_cmov_reg_f( cmpOpF cmp, iRegI dst, iRegI src, flagsRegF fcc ) %{
@@ -2319,8 +2311,7 @@
              (0 << 13) |                    // select register move
              ($fcc$$reg << 11) |            // cc1, cc0 bits for fcc0-fcc3
              ($src$$reg << 0);
-    *((int*)(cbuf.code_end())) = op;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32(op);
   %}
 
   enc_class enc_cmov_imm_f( cmpOp cmp, iRegI dst, immI11 src, flagsRegF fcc ) %{
@@ -2333,8 +2324,7 @@
              (1 << 13) |                    // select immediate move
              ($fcc$$reg << 11) |            // cc1, cc0 bits for fcc0-fcc3
              (simm11 << 0);
-    *((int*)(cbuf.code_end())) = op;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32(op);
   %}
 
   enc_class enc_cmovf_reg( cmpOp cmp, regD dst, regD src, immI pcc ) %{
@@ -2347,8 +2337,7 @@
              ($pcc$$constant << 11) |       // cc1-cc0 bits for 'icc' or 'xcc'
              ($primary << 5) |              // select single, double or quad
              ($src$$reg << 0);
-    *((int*)(cbuf.code_end())) = op;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32(op);
   %}
 
   enc_class enc_cmovff_reg( cmpOpF cmp, flagsRegF fcc, regD dst, regD src ) %{
@@ -2360,8 +2349,7 @@
              ($fcc$$reg << 11) |            // cc2-cc0 bits for 'fccX'
              ($primary << 5) |              // select single, double or quad
              ($src$$reg << 0);
-    *((int*)(cbuf.code_end())) = op;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32(op);
   %}
 
   // Used by the MIN/MAX encodings.  Same as a CMOV, but
@@ -2375,8 +2363,7 @@
              (0 << 13) |                    // select register move
              (0 << 11) |                    // cc1, cc0 bits for 'icc'
              ($src$$reg << 0);
-    *((int*)(cbuf.code_end())) = op;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32(op);
   %}
 
   enc_class enc_cmov_reg_minmax_long( iRegL dst, iRegL src ) %{
@@ -2388,8 +2375,7 @@
              (0 << 13) |                    // select register move
              (0 << 11) |                    // cc1, cc0 bits for 'icc'
              ($src$$reg << 0);
-    *((int*)(cbuf.code_end())) = op;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32(op);
   %}
 
   // Utility encoding for loading a 64 bit Pointer into a register
@@ -3055,7 +3041,7 @@
   %}
 
   enc_class enc_rethrow() %{
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     Register temp_reg = G3;
     AddressLiteral rethrow_stub(OptoRuntime::rethrow_stub());
     assert(temp_reg != reg_to_register_object(R_I0_num), "temp must not break oop_reg");
@@ -3076,23 +3062,17 @@
 
   enc_class emit_mem_nop() %{
     // Generates the instruction LDUXA [o6,g0],#0x82,g0
-    unsigned int *code = (unsigned int*)cbuf.code_end();
-    *code = (unsigned int)0xc0839040;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32((unsigned int) 0xc0839040);
   %}
 
   enc_class emit_fadd_nop() %{
     // Generates the instruction FMOVS f31,f31
-    unsigned int *code = (unsigned int*)cbuf.code_end();
-    *code = (unsigned int)0xbfa0003f;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32((unsigned int) 0xbfa0003f);
   %}
 
   enc_class emit_br_nop() %{
     // Generates the instruction BPN,PN .
-    unsigned int *code = (unsigned int*)cbuf.code_end();
-    *code = (unsigned int)0x00400000;
-    cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
+    cbuf.insts()->emit_int32((unsigned int) 0x00400000);
   %}
 
   enc_class enc_membar_acquire %{
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -141,12 +141,12 @@
     }
 
     // Could just be some random pointer within the codeBlob
-
-    if (!sender_blob->instructions_contains(sender_pc)) return false;
+    if (!sender_blob->code_contains(sender_pc)) {
+      return false;
+    }
 
     // We should never be able to see an adapter if the current frame is something from code cache
-
-    if ( sender_blob->is_adapter_blob()) {
+    if (sender_blob->is_adapter_blob()) {
       return false;
     }
 
@@ -340,7 +340,7 @@
   fr._unextended_sp = unextended_sp;
 
   address original_pc = nm->get_original_pc(&fr);
-  assert(nm->code_contains(original_pc), "original PC must be in nmethod");
+  assert(nm->insts_contains(original_pc), "original PC must be in nmethod");
   assert(nm->is_method_handle_return(original_pc) == is_method_handle_return, "must be");
 }
 #endif
--- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp	Wed Aug 25 05:27:54 2010 -0700
@@ -63,7 +63,7 @@
   address original_pc = nmethod::get_deopt_original_pc(this);
   if (original_pc != NULL) {
     _pc = original_pc;
-    assert(((nmethod*)_cb)->code_contains(_pc), "original PC must be in nmethod");
+    assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod");
     _deopt_state = is_deoptimized;
   } else {
     _deopt_state = not_deoptimized;
--- a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,10 +54,10 @@
     default:        ShouldNotReachHere();
   }
   ResourceMark rm;
-  BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
-  address fast_entry = b->instructions_begin();
-  CodeBuffer cbuf(fast_entry, b->instructions_size());
+  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+  CodeBuffer cbuf(blob);
   MacroAssembler* masm = new MacroAssembler(&cbuf);
+  address fast_entry = __ pc();
 
   Label slow;
 
@@ -135,11 +135,11 @@
   return fast_entry;
 #else
   switch (type) {
-    case T_BOOLEAN: jni_fast_GetBooleanField_fp = (GetBooleanField_t)fast_entry; break;
-    case T_BYTE:    jni_fast_GetByteField_fp = (GetByteField_t)fast_entry; break;
-    case T_CHAR:    jni_fast_GetCharField_fp = (GetCharField_t)fast_entry; break;
-    case T_SHORT:   jni_fast_GetShortField_fp = (GetShortField_t)fast_entry; break;
-    case T_INT:     jni_fast_GetIntField_fp = (GetIntField_t)fast_entry;
+  case T_BOOLEAN: jni_fast_GetBooleanField_fp = (GetBooleanField_t) fast_entry; break;
+  case T_BYTE:    jni_fast_GetByteField_fp    = (GetByteField_t)    fast_entry; break;
+  case T_CHAR:    jni_fast_GetCharField_fp    = (GetCharField_t)    fast_entry; break;
+  case T_SHORT:   jni_fast_GetShortField_fp   = (GetShortField_t)   fast_entry; break;
+  case T_INT:     jni_fast_GetIntField_fp     = (GetIntField_t)     fast_entry; break;
   }
   return os::win32::fast_jni_accessor_wrapper(type);
 #endif
@@ -168,10 +168,10 @@
 address JNI_FastGetField::generate_fast_get_long_field() {
   const char *name = "jni_fast_GetLongField";
   ResourceMark rm;
-  BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
-  address fast_entry = b->instructions_begin();
-  CodeBuffer cbuf(fast_entry, b->instructions_size());
+  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+  CodeBuffer cbuf(blob);
   MacroAssembler* masm = new MacroAssembler(&cbuf);
+  address fast_entry = __ pc();
 
   Label slow;
 
@@ -246,7 +246,7 @@
 #ifndef _WINDOWS
   return fast_entry;
 #else
-  jni_fast_GetLongField_fp = (GetLongField_t)fast_entry;
+  jni_fast_GetLongField_fp = (GetLongField_t) fast_entry;
   return os::win32::fast_jni_accessor_wrapper(T_LONG);
 #endif
 }
@@ -259,10 +259,10 @@
     default:       ShouldNotReachHere();
   }
   ResourceMark rm;
-  BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE*wordSize);
-  address fast_entry = b->instructions_begin();
-  CodeBuffer cbuf(fast_entry, b->instructions_size());
+  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE*wordSize);
+  CodeBuffer cbuf(blob);
   MacroAssembler* masm = new MacroAssembler(&cbuf);
+  address fast_entry = __ pc();
 
   Label slow_with_pop, slow;
 
@@ -348,8 +348,8 @@
   return fast_entry;
 #else
   switch (type) {
-    case T_FLOAT:  jni_fast_GetFloatField_fp = (GetFloatField_t)fast_entry; break;
-    case T_DOUBLE: jni_fast_GetDoubleField_fp = (GetDoubleField_t)fast_entry;
+  case T_FLOAT:  jni_fast_GetFloatField_fp  = (GetFloatField_t)  fast_entry; break;
+  case T_DOUBLE: jni_fast_GetDoubleField_fp = (GetDoubleField_t) fast_entry; break;
   }
   return os::win32::fast_jni_accessor_wrapper(type);
 #endif
--- a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,10 +58,10 @@
     default:        ShouldNotReachHere();
   }
   ResourceMark rm;
-  BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE);
-  address fast_entry = b->instructions_begin();
-  CodeBuffer cbuf(fast_entry, b->instructions_size());
+  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
+  CodeBuffer cbuf(blob);
   MacroAssembler* masm = new MacroAssembler(&cbuf);
+  address fast_entry = __ pc();
 
   Label slow;
 
@@ -156,10 +156,10 @@
     default:          ShouldNotReachHere();
   }
   ResourceMark rm;
-  BufferBlob* b = BufferBlob::create(name, BUFFER_SIZE);
-  address fast_entry = b->instructions_begin();
-  CodeBuffer cbuf(fast_entry, b->instructions_size());
+  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
+  CodeBuffer cbuf(blob);
   MacroAssembler* masm = new MacroAssembler(&cbuf);
+  address fast_entry = __ pc();
 
   Label slow;
 
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -595,8 +595,7 @@
   if (stub_blob == NULL) {
     vm_exit_during_initialization("Unable to allocate getPsrInfo_stub");
   }
-  CodeBuffer c(stub_blob->instructions_begin(),
-               stub_blob->instructions_size());
+  CodeBuffer c(stub_blob);
   VM_Version_StubGenerator g(&c);
   getPsrInfo_stub = CAST_TO_FN_PTR(getPsrInfo_stub_t,
                                    g.generate_getPsrInfo());
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Wed Aug 25 05:27:54 2010 -0700
@@ -350,54 +350,46 @@
 // EMIT_RM()
 void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3) {
   unsigned char c = (unsigned char)((f1 << 6) | (f2 << 3) | f3);
-  *(cbuf.code_end()) = c;
-  cbuf.set_code_end(cbuf.code_end() + 1);
+  cbuf.insts()->emit_int8(c);
 }
 
 // EMIT_CC()
 void emit_cc(CodeBuffer &cbuf, int f1, int f2) {
   unsigned char c = (unsigned char)( f1 | f2 );
-  *(cbuf.code_end()) = c;
-  cbuf.set_code_end(cbuf.code_end() + 1);
+  cbuf.insts()->emit_int8(c);
 }
 
 // EMIT_OPCODE()
 void emit_opcode(CodeBuffer &cbuf, int code) {
-  *(cbuf.code_end()) = (unsigned char)code;
-  cbuf.set_code_end(cbuf.code_end() + 1);
+  cbuf.insts()->emit_int8((unsigned char) code);
 }
 
 // EMIT_OPCODE() w/ relocation information
 void emit_opcode(CodeBuffer &cbuf, int code, relocInfo::relocType reloc, int offset = 0) {
-  cbuf.relocate(cbuf.inst_mark() + offset, reloc);
+  cbuf.relocate(cbuf.insts_mark() + offset, reloc);
   emit_opcode(cbuf, code);
 }
 
 // EMIT_D8()
 void emit_d8(CodeBuffer &cbuf, int d8) {
-  *(cbuf.code_end()) = (unsigned char)d8;
-  cbuf.set_code_end(cbuf.code_end() + 1);
+  cbuf.insts()->emit_int8((unsigned char) d8);
 }
 
 // EMIT_D16()
 void emit_d16(CodeBuffer &cbuf, int d16) {
-  *((short *)(cbuf.code_end())) = d16;
-  cbuf.set_code_end(cbuf.code_end() + 2);
+  cbuf.insts()->emit_int16(d16);
 }
 
 // EMIT_D32()
 void emit_d32(CodeBuffer &cbuf, int d32) {
-  *((int *)(cbuf.code_end())) = d32;
-  cbuf.set_code_end(cbuf.code_end() + 4);
+  cbuf.insts()->emit_int32(d32);
 }
 
 // emit 32 bit value and construct relocation entry from relocInfo::relocType
 void emit_d32_reloc(CodeBuffer &cbuf, int d32, relocInfo::relocType reloc,
         int format) {
-  cbuf.relocate(cbuf.inst_mark(), reloc, format);
-
-  *((int *)(cbuf.code_end())) = d32;
-  cbuf.set_code_end(cbuf.code_end() + 4);
+  cbuf.relocate(cbuf.insts_mark(), reloc, format);
+  cbuf.insts()->emit_int32(d32);
 }
 
 // emit 32 bit value and construct relocation entry from RelocationHolder
@@ -408,10 +400,8 @@
     assert(oop(d32)->is_oop() && (ScavengeRootsInCode || !oop(d32)->is_scavengable()), "cannot embed scavengable oops in code");
   }
 #endif
-  cbuf.relocate(cbuf.inst_mark(), rspec, format);
-
-  *((int *)(cbuf.code_end())) = d32;
-  cbuf.set_code_end(cbuf.code_end() + 4);
+  cbuf.relocate(cbuf.insts_mark(), rspec, format);
+  cbuf.insts()->emit_int32(d32);
 }
 
 // Access stack slot for load or store
@@ -613,7 +603,7 @@
     emit_rm(cbuf, 0x3, 0x05, ESP_enc);
     emit_d32(cbuf, framesize);
   }
-  C->set_frame_complete(cbuf.code_end() - cbuf.code_begin());
+  C->set_frame_complete(cbuf.insts_size());
 
 #ifdef ASSERT
   if (VerifyStackAtCalls) {
@@ -695,7 +685,7 @@
   emit_opcode(cbuf, 0x58 | EBP_enc);
 
   if( do_polling() && C->is_method_compilation() ) {
-    cbuf.relocate(cbuf.code_end(), relocInfo::poll_return_type, 0);
+    cbuf.relocate(cbuf.insts_end(), relocInfo::poll_return_type, 0);
     emit_opcode(cbuf,0x85);
     emit_rm(cbuf, 0x0, EAX_enc, 0x5); // EAX
     emit_d32(cbuf, (intptr_t)os::get_polling_page());
@@ -1211,9 +1201,9 @@
   // mov rbx,0
   // jmp -1
 
-  address mark = cbuf.inst_mark();  // get mark within main instrs section
-
-  // Note that the code buffer's inst_mark is always relative to insts.
+  address mark = cbuf.insts_mark();  // get mark within main instrs section
+
+  // Note that the code buffer's insts_mark is always relative to insts.
   // That's why we must use the macroassembler to generate a stub.
   MacroAssembler _masm(&cbuf);
 
@@ -1228,7 +1218,7 @@
   __ jump(RuntimeAddress(__ pc()));
 
   __ end_a_stub();
-  // Update current stubs pointer and restore code_end.
+  // Update current stubs pointer and restore insts_end.
 }
 // size of call stub, compiled java to interpretor
 uint size_java_to_interp() {
@@ -1254,7 +1244,7 @@
 void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
   MacroAssembler masm(&cbuf);
 #ifdef ASSERT
-  uint code_size = cbuf.code_size();
+  uint insts_size = cbuf.insts_size();
 #endif
   masm.cmpptr(rax, Address(rcx, oopDesc::klass_offset_in_bytes()));
   masm.jump_cc(Assembler::notEqual,
@@ -1266,7 +1256,7 @@
      nops_cnt += 1;
   masm.nop(nops_cnt);
 
-  assert(cbuf.code_size() - code_size == size(ra_), "checking code size of inline cache node");
+  assert(cbuf.insts_size() - insts_size == size(ra_), "checking code size of inline cache node");
 }
 
 uint MachUEPNode::size(PhaseRegAlloc *ra_) const {
@@ -1288,14 +1278,14 @@
 // and call a VM stub routine.
 int emit_exception_handler(CodeBuffer& cbuf) {
 
-  // Note that the code buffer's inst_mark is always relative to insts.
+  // Note that the code buffer's insts_mark is always relative to insts.
   // That's why we must use the macroassembler to generate a handler.
   MacroAssembler _masm(&cbuf);
   address base =
   __ start_a_stub(size_exception_handler());
   if (base == NULL)  return 0;  // CodeBuffer::expand failed
   int offset = __ offset();
-  __ jump(RuntimeAddress(OptoRuntime::exception_blob()->instructions_begin()));
+  __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));
   assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
   __ end_a_stub();
   return offset;
@@ -1313,7 +1303,7 @@
 // Emit deopt handler code.
 int emit_deopt_handler(CodeBuffer& cbuf) {
 
-  // Note that the code buffer's inst_mark is always relative to insts.
+  // Note that the code buffer's insts_mark is always relative to insts.
   // That's why we must use the macroassembler to generate a handler.
   MacroAssembler _masm(&cbuf);
   address base =
@@ -1728,12 +1718,12 @@
 
   enc_class Lbl (label labl) %{ // JMP, CALL
     Label *l = $labl$$label;
-    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size()+4)) : 0);
+    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0);
   %}
 
   enc_class LblShort (label labl) %{ // JMP, CALL
     Label *l = $labl$$label;
-    int disp = l ? (l->loc_pos() - (cbuf.code_size()+1)) : 0;
+    int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0;
     assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
     emit_d8(cbuf, disp);
   %}
@@ -1764,13 +1754,13 @@
     Label *l = $labl$$label;
     $$$emit8$primary;
     emit_cc(cbuf, $secondary, $cop$$cmpcode);
-    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size()+4)) : 0);
+    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0);
   %}
 
   enc_class JccShort (cmpOp cop, label labl) %{    // JCC
     Label *l = $labl$$label;
     emit_cc(cbuf, $primary, $cop$$cmpcode);
-    int disp = l ? (l->loc_pos() - (cbuf.code_size()+1)) : 0;
+    int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0;
     assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
     emit_d8(cbuf, disp);
   %}
@@ -1838,10 +1828,10 @@
 
   enc_class Java_To_Runtime (method meth) %{    // CALL Java_To_Runtime, Java_To_Runtime_Leaf
     // This is the instruction starting address for relocation info.
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
     // CALL directly to the runtime
-    emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+    emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
                 runtime_call_Relocation::spec(), RELOC_IMM32 );
 
     if (UseSSE >= 2) {
@@ -1871,12 +1861,12 @@
 
   enc_class pre_call_FPU %{
     // If method sets FPU control word restore it here
-    debug_only(int off0 = cbuf.code_size());
+    debug_only(int off0 = cbuf.insts_size());
     if( Compile::current()->in_24_bit_fp_mode() ) {
       MacroAssembler masm(&cbuf);
       masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std()));
     }
-    debug_only(int off1 = cbuf.code_size());
+    debug_only(int off1 = cbuf.insts_size());
     assert(off1 - off0 == pre_call_FPU_size(), "correct size prediction");
   %}
 
@@ -1889,12 +1879,12 @@
   %}
 
   enc_class preserve_SP %{
-    debug_only(int off0 = cbuf.code_size());
+    debug_only(int off0 = cbuf.insts_size());
     MacroAssembler _masm(&cbuf);
     // RBP is preserved across all calls, even compiled calls.
     // Use it to preserve RSP in places where the callee might change the SP.
     __ movptr(rbp_mh_SP_save, rsp);
-    debug_only(int off1 = cbuf.code_size());
+    debug_only(int off1 = cbuf.insts_size());
     assert(off1 - off0 == preserve_SP_size(), "correct size prediction");
   %}
 
@@ -1906,16 +1896,16 @@
   enc_class Java_Static_Call (method meth) %{    // JAVA STATIC CALL
     // CALL to fixup routine.  Fixup routine uses ScopeDesc info to determine
     // who we intended to call.
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
     if ( !_method ) {
-      emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+      emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
                      runtime_call_Relocation::spec(), RELOC_IMM32 );
     } else if(_optimized_virtual) {
-      emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+      emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
                      opt_virtual_call_Relocation::spec(), RELOC_IMM32 );
     } else {
-      emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+      emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
                      static_call_Relocation::spec(), RELOC_IMM32 );
     }
     if( _method ) {  // Emit stub for static call
@@ -1927,15 +1917,15 @@
     // !!!!!
     // Generate  "Mov EAX,0x00", placeholder instruction to load oop-info
     // emit_call_dynamic_prologue( cbuf );
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0xB8 + EAX_enc);        // mov    EAX,-1
     emit_d32_reloc(cbuf, (int)Universe::non_oop_word(), oop_Relocation::spec_for_immediate(), RELOC_IMM32);
-    address  virtual_call_oop_addr = cbuf.inst_mark();
+    address  virtual_call_oop_addr = cbuf.insts_mark();
     // CALL to fixup routine.  Fixup routine uses ScopeDesc info to determine
     // who we intended to call.
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
-    emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4),
+    emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
                 virtual_call_Relocation::spec(virtual_call_oop_addr), RELOC_IMM32 );
   %}
 
@@ -1944,7 +1934,7 @@
     assert( -128 <= disp && disp <= 127, "compiled_code_offset isn't small");
 
     // CALL *[EAX+in_bytes(methodOopDesc::from_compiled_code_entry_point_offset())]
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
     emit_rm(cbuf, 0x01, $secondary, EAX_enc );  // R/M byte
     emit_d8(cbuf, disp);             // Displacement
@@ -1976,9 +1966,9 @@
 //     emit_rm(cbuf, 0x3, EBP_enc, EBP_enc);
 //
 //     // CALL to interpreter.
-//     cbuf.set_inst_mark();
+//     cbuf.set_insts_mark();
 //     $$$emit8$primary;
-//     emit_d32_reloc(cbuf, ($labl$$label - (int)(cbuf.code_end()) - 4),
+//     emit_d32_reloc(cbuf, ($labl$$label - (int)(cbuf.insts_end()) - 4),
 //                 runtime_call_Relocation::spec(), RELOC_IMM32 );
 //   %}
 
@@ -2087,7 +2077,7 @@
   %}
 
   enc_class Opc_MemImm_F(immF src) %{
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
     emit_rm(cbuf, 0x0, $secondary, 0x5);
     emit_float_constant(cbuf, $src$$constant);
@@ -2280,7 +2270,7 @@
   %}
 
   enc_class set_instruction_start( ) %{
-    cbuf.set_inst_mark();            // Mark start of opcode for reloc info in mem operand
+    cbuf.set_insts_mark();            // Mark start of opcode for reloc info in mem operand
   %}
 
   enc_class RegMem (eRegI ereg, memory mem) %{    // emit_reg_mem
@@ -2429,7 +2419,7 @@
       emit_opcode( cbuf, 0xD9 ); // FLD (i.e., push it)
       emit_d8( cbuf, 0xC0-1+$src$$reg );
     }
-    cbuf.set_inst_mark();       // Mark start of opcode for reloc info in mem operand
+    cbuf.set_insts_mark();       // Mark start of opcode for reloc info in mem operand
     emit_opcode(cbuf,$primary);
     encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop);
   %}
@@ -2474,7 +2464,7 @@
     emit_opcode(cbuf,0x1B);
     emit_rm(cbuf, 0x3, tmpReg, tmpReg);
     // AND $tmp,$y
-    cbuf.set_inst_mark();       // Mark start of opcode for reloc info in mem operand
+    cbuf.set_insts_mark();       // Mark start of opcode for reloc info in mem operand
     emit_opcode(cbuf,0x23);
     int reg_encoding = tmpReg;
     int base  = $mem$$base;
@@ -3157,9 +3147,9 @@
     // PUSH src2.lo
     emit_opcode(cbuf,               0x50+$src2$$reg  );
     // CALL directly to the runtime
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf,0xE8);       // Call into runtime
-    emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::ldiv) - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+    emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::ldiv) - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
     // Restore stack
     emit_opcode(cbuf, 0x83); // add  SP, #framesize
     emit_rm(cbuf, 0x3, 0x00, ESP_enc);
@@ -3176,9 +3166,9 @@
     // PUSH src2.lo
     emit_opcode(cbuf,               0x50+$src2$$reg  );
     // CALL directly to the runtime
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf,0xE8);       // Call into runtime
-    emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::lrem ) - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+    emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::lrem ) - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
     // Restore stack
     emit_opcode(cbuf, 0x83); // add  SP, #framesize
     emit_rm(cbuf, 0x3, 0x00, ESP_enc);
@@ -3824,9 +3814,9 @@
   %}
 
   enc_class enc_rethrow() %{
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0xE9);        // jmp    entry
-    emit_d32_reloc(cbuf, (int)OptoRuntime::rethrow_stub() - ((int)cbuf.code_end())-4,
+    emit_d32_reloc(cbuf, (int)OptoRuntime::rethrow_stub() - ((int)cbuf.insts_end())-4,
                    runtime_call_Relocation::spec(), RELOC_IMM32 );
   %}
 
@@ -3873,9 +3863,9 @@
     emit_opcode(cbuf,0xD9 );      // FLD     ST(i)
     emit_d8    (cbuf,0xC0-1+$src$$reg );
     // CALL directly to the runtime
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf,0xE8);       // Call into runtime
-    emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+    emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
     // Carry on here...
   %}
 
@@ -3915,9 +3905,9 @@
     emit_opcode(cbuf,0xD9 );      // FLD     ST(i)
     emit_d8    (cbuf,0xC0-1+$src$$reg );
     // CALL directly to the runtime
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf,0xE8);       // Call into runtime
-    emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+    emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
     // Carry on here...
   %}
 
@@ -3988,9 +3978,9 @@
     emit_d8(cbuf,0x04);
 
     // CALL directly to the runtime
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf,0xE8);       // Call into runtime
-    emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+    emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
     // Carry on here...
   %}
 
@@ -4062,9 +4052,9 @@
     emit_d8(cbuf,0x08);
 
     // CALL directly to the runtime
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf,0xE8);      // Call into runtime
-    emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+    emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
     // Carry on here...
   %}
 
@@ -4122,9 +4112,9 @@
     emit_d8(cbuf, $primary ? 0x8 : 0x4);
 
     // CALL directly to the runtime
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf,0xE8);       // Call into runtime
-    emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
+    emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 );
 
     // Carry on here...
   %}
@@ -4321,7 +4311,7 @@
   // so the memory operand is used twice in the encoding.
   enc_class enc_storeL_volatile( memory mem, stackSlotL src ) %{
     store_to_stackslot( cbuf, 0x0DF, 0x05, $src$$disp );
-    cbuf.set_inst_mark();            // Mark start of FIST in case $mem has an oop
+    cbuf.set_insts_mark();            // Mark start of FIST in case $mem has an oop
     emit_opcode(cbuf,0xDF);
     int rm_byte_opcode = 0x07;
     int base     = $mem$$base;
@@ -4345,7 +4335,7 @@
       bool disp_is_oop = $src->disp_is_oop(); // disp-as-oop when working with static globals
       encode_RegMem(cbuf, $tmp$$reg, base, index, scale, displace, disp_is_oop);
     }
-    cbuf.set_inst_mark();            // Mark start of MOVSD in case $mem has an oop
+    cbuf.set_insts_mark();            // Mark start of MOVSD in case $mem has an oop
     { // MOVSD $mem,$tmp ! atomic long store
       emit_opcode(cbuf,0xF2);
       emit_opcode(cbuf,0x0F);
@@ -4378,7 +4368,7 @@
       emit_opcode(cbuf,0x62);
       emit_rm(cbuf, 0x3, $tmp$$reg, $tmp2$$reg);
     }
-    cbuf.set_inst_mark();            // Mark start of MOVSD in case $mem has an oop
+    cbuf.set_insts_mark();            // Mark start of MOVSD in case $mem has an oop
     { // MOVSD $mem,$tmp ! atomic long store
       emit_opcode(cbuf,0xF2);
       emit_opcode(cbuf,0x0F);
@@ -4399,7 +4389,7 @@
   // A better choice might be TESTB [spp + pagesize() - CacheLineSize()],0
 
   enc_class Safepoint_Poll() %{
-    cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_type, 0);
+    cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_type, 0);
     emit_opcode(cbuf,0x85);
     emit_rm (cbuf, 0x0, 0x7, 0x5);
     emit_d32(cbuf, (intptr_t)os::get_polling_page());
@@ -12932,7 +12922,7 @@
     bool ok = false;
     if ($cop$$cmpcode == Assembler::notEqual) {
        // the two jumps 6 bytes apart so the jump distances are too
-       parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0;
+       parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
     } else if ($cop$$cmpcode == Assembler::equal) {
        parity_disp = 6;
        ok = true;
@@ -12942,7 +12932,7 @@
     emit_d32(cbuf, parity_disp);
     $$$emit8$primary;
     emit_cc(cbuf, $secondary, $cop$$cmpcode);
-    int disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0;
+    int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
     emit_d32(cbuf, disp);
   %}
   ins_pipe(pipe_jcc);
@@ -13128,7 +13118,7 @@
     emit_cc(cbuf, $primary, Assembler::parity);
     int parity_disp = -1;
     if ($cop$$cmpcode == Assembler::notEqual) {
-      parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+      parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
     } else if ($cop$$cmpcode == Assembler::equal) {
       parity_disp = 2;
     } else {
@@ -13136,7 +13126,7 @@
     }
     emit_d8(cbuf, parity_disp);
     emit_cc(cbuf, $primary, $cop$$cmpcode);
-    int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+    int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
     emit_d8(cbuf, disp);
     assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
     assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp");
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Wed Aug 25 05:27:54 2010 -0700
@@ -619,62 +619,48 @@
 #endif
 
 // EMIT_RM()
-void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3)
-{
+void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3) {
   unsigned char c = (unsigned char) ((f1 << 6) | (f2 << 3) | f3);
-  *(cbuf.code_end()) = c;
-  cbuf.set_code_end(cbuf.code_end() + 1);
+  cbuf.insts()->emit_int8(c);
 }
 
 // EMIT_CC()
-void emit_cc(CodeBuffer &cbuf, int f1, int f2)
-{
+void emit_cc(CodeBuffer &cbuf, int f1, int f2) {
   unsigned char c = (unsigned char) (f1 | f2);
-  *(cbuf.code_end()) = c;
-  cbuf.set_code_end(cbuf.code_end() + 1);
+  cbuf.insts()->emit_int8(c);
 }
 
 // EMIT_OPCODE()
-void emit_opcode(CodeBuffer &cbuf, int code)
-{
-  *(cbuf.code_end()) = (unsigned char) code;
-  cbuf.set_code_end(cbuf.code_end() + 1);
+void emit_opcode(CodeBuffer &cbuf, int code) {
+  cbuf.insts()->emit_int8((unsigned char) code);
 }
 
 // EMIT_OPCODE() w/ relocation information
 void emit_opcode(CodeBuffer &cbuf,
                  int code, relocInfo::relocType reloc, int offset, int format)
 {
-  cbuf.relocate(cbuf.inst_mark() + offset, reloc, format);
+  cbuf.relocate(cbuf.insts_mark() + offset, reloc, format);
   emit_opcode(cbuf, code);
 }
 
 // EMIT_D8()
-void emit_d8(CodeBuffer &cbuf, int d8)
-{
-  *(cbuf.code_end()) = (unsigned char) d8;
-  cbuf.set_code_end(cbuf.code_end() + 1);
+void emit_d8(CodeBuffer &cbuf, int d8) {
+  cbuf.insts()->emit_int8((unsigned char) d8);
 }
 
 // EMIT_D16()
-void emit_d16(CodeBuffer &cbuf, int d16)
-{
-  *((short *)(cbuf.code_end())) = d16;
-  cbuf.set_code_end(cbuf.code_end() + 2);
+void emit_d16(CodeBuffer &cbuf, int d16) {
+  cbuf.insts()->emit_int16(d16);
 }
 
 // EMIT_D32()
-void emit_d32(CodeBuffer &cbuf, int d32)
-{
-  *((int *)(cbuf.code_end())) = d32;
-  cbuf.set_code_end(cbuf.code_end() + 4);
+void emit_d32(CodeBuffer &cbuf, int d32) {
+  cbuf.insts()->emit_int32(d32);
 }
 
 // EMIT_D64()
-void emit_d64(CodeBuffer &cbuf, int64_t d64)
-{
-  *((int64_t*) (cbuf.code_end())) = d64;
-  cbuf.set_code_end(cbuf.code_end() + 8);
+void emit_d64(CodeBuffer &cbuf, int64_t d64) {
+  cbuf.insts()->emit_int64(d64);
 }
 
 // emit 32 bit value and construct relocation entry from relocInfo::relocType
@@ -684,32 +670,24 @@
                     int format)
 {
   assert(reloc != relocInfo::external_word_type, "use 2-arg emit_d32_reloc");
-  cbuf.relocate(cbuf.inst_mark(), reloc, format);
-
-  *((int*) (cbuf.code_end())) = d32;
-  cbuf.set_code_end(cbuf.code_end() + 4);
+  cbuf.relocate(cbuf.insts_mark(), reloc, format);
+  cbuf.insts()->emit_int32(d32);
 }
 
 // emit 32 bit value and construct relocation entry from RelocationHolder
-void emit_d32_reloc(CodeBuffer& cbuf,
-                    int d32,
-                    RelocationHolder const& rspec,
-                    int format)
-{
+void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, int format) {
 #ifdef ASSERT
   if (rspec.reloc()->type() == relocInfo::oop_type &&
       d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
     assert(oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code");
   }
 #endif
-  cbuf.relocate(cbuf.inst_mark(), rspec, format);
-
-  *((int* )(cbuf.code_end())) = d32;
-  cbuf.set_code_end(cbuf.code_end() + 4);
+  cbuf.relocate(cbuf.insts_mark(), rspec, format);
+  cbuf.insts()->emit_int32(d32);
 }
 
 void emit_d32_reloc(CodeBuffer& cbuf, address addr) {
-  address next_ip = cbuf.code_end() + 4;
+  address next_ip = cbuf.insts_end() + 4;
   emit_d32_reloc(cbuf, (int) (addr - next_ip),
                  external_word_Relocation::spec(addr),
                  RELOC_DISP32);
@@ -717,23 +695,13 @@
 
 
 // emit 64 bit value and construct relocation entry from relocInfo::relocType
-void emit_d64_reloc(CodeBuffer& cbuf,
-                    int64_t d64,
-                    relocInfo::relocType reloc,
-                    int format)
-{
-  cbuf.relocate(cbuf.inst_mark(), reloc, format);
-
-  *((int64_t*) (cbuf.code_end())) = d64;
-  cbuf.set_code_end(cbuf.code_end() + 8);
+void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, relocInfo::relocType reloc, int format) {
+  cbuf.relocate(cbuf.insts_mark(), reloc, format);
+  cbuf.insts()->emit_int64(d64);
 }
 
 // emit 64 bit value and construct relocation entry from RelocationHolder
-void emit_d64_reloc(CodeBuffer& cbuf,
-                    int64_t d64,
-                    RelocationHolder const& rspec,
-                    int format)
-{
+void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec, int format) {
 #ifdef ASSERT
   if (rspec.reloc()->type() == relocInfo::oop_type &&
       d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) {
@@ -741,10 +709,8 @@
            "cannot embed scavengable oops in code");
   }
 #endif
-  cbuf.relocate(cbuf.inst_mark(), rspec, format);
-
-  *((int64_t*) (cbuf.code_end())) = d64;
-  cbuf.set_code_end(cbuf.code_end() + 8);
+  cbuf.relocate(cbuf.insts_mark(), rspec, format);
+  cbuf.insts()->emit_int64(d64);
 }
 
 // Access stack slot for load or store
@@ -966,7 +932,7 @@
     }
   }
 
-  C->set_frame_complete(cbuf.code_end() - cbuf.code_begin());
+  C->set_frame_complete(cbuf.insts_size());
 
 #ifdef ASSERT
   if (VerifyStackAtCalls) {
@@ -1050,11 +1016,11 @@
   if (do_polling() && C->is_method_compilation()) {
     // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes
     // XXX reg_mem doesn't support RIP-relative addressing yet
-    cbuf.set_inst_mark();
-    cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_return_type, 0); // XXX
+    cbuf.set_insts_mark();
+    cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_return_type, 0); // XXX
     emit_opcode(cbuf, 0x85); // testl
     emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5
-    // cbuf.inst_mark() is beginning of instruction
+    // cbuf.insts_mark() is beginning of instruction
     emit_d32_reloc(cbuf, os::get_polling_page());
 //                    relocInfo::poll_return_type,
   }
@@ -1814,9 +1780,9 @@
   // movq rbx, 0
   // jmp -5 # to self
 
-  address mark = cbuf.inst_mark();  // get mark within main instrs section
-
-  // Note that the code buffer's inst_mark is always relative to insts.
+  address mark = cbuf.insts_mark();  // get mark within main instrs section
+
+  // Note that the code buffer's insts_mark is always relative to insts.
   // That's why we must use the macroassembler to generate a stub.
   MacroAssembler _masm(&cbuf);
 
@@ -1830,7 +1796,7 @@
   // This is recognized as unresolved by relocs/nativeinst/ic code
   __ jump(RuntimeAddress(__ pc()));
 
-  // Update current stubs pointer and restore code_end.
+  // Update current stubs pointer and restore insts_end.
   __ end_a_stub();
 }
 
@@ -1868,7 +1834,7 @@
 void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
 {
   MacroAssembler masm(&cbuf);
-  uint code_size = cbuf.code_size();
+  uint insts_size = cbuf.insts_size();
   if (UseCompressedOops) {
     masm.load_klass(rscratch1, j_rarg0);
     masm.cmpptr(rax, rscratch1);
@@ -1880,7 +1846,7 @@
 
   /* WARNING these NOPs are critical so that verified entry point is properly
      4 bytes aligned for patching by NativeJump::patch_verified_entry() */
-  int nops_cnt = 4 - ((cbuf.code_size() - code_size) & 0x3);
+  int nops_cnt = 4 - ((cbuf.insts_size() - insts_size) & 0x3);
   if (OptoBreakpoint) {
     // Leave space for int3
     nops_cnt -= 1;
@@ -1910,14 +1876,14 @@
 int emit_exception_handler(CodeBuffer& cbuf)
 {
 
-  // Note that the code buffer's inst_mark is always relative to insts.
+  // Note that the code buffer's insts_mark is always relative to insts.
   // That's why we must use the macroassembler to generate a handler.
   MacroAssembler _masm(&cbuf);
   address base =
   __ start_a_stub(size_exception_handler());
   if (base == NULL)  return 0;  // CodeBuffer::expand failed
   int offset = __ offset();
-  __ jump(RuntimeAddress(OptoRuntime::exception_blob()->instructions_begin()));
+  __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));
   assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
   __ end_a_stub();
   return offset;
@@ -1933,7 +1899,7 @@
 int emit_deopt_handler(CodeBuffer& cbuf)
 {
 
-  // Note that the code buffer's inst_mark is always relative to insts.
+  // Note that the code buffer's insts_mark is always relative to insts.
   // That's why we must use the macroassembler to generate a handler.
   MacroAssembler _masm(&cbuf);
   address base =
@@ -1962,7 +1928,7 @@
   address double_address = __ double_constant(x);
   cbuf.insts()->set_mark_off(mark);  // preserve mark across masm shift
   emit_d32_reloc(cbuf,
-                 (int) (double_address - cbuf.code_end() - 4),
+                 (int) (double_address - cbuf.insts_end() - 4),
                  internal_word_Relocation::spec(double_address),
                  RELOC_DISP32);
 }
@@ -1973,7 +1939,7 @@
   address float_address = __ float_constant(x);
   cbuf.insts()->set_mark_off(mark);  // preserve mark across masm shift
   emit_d32_reloc(cbuf,
-                 (int) (float_address - cbuf.code_end() - 4),
+                 (int) (float_address - cbuf.insts_end() - 4),
                  internal_word_Relocation::spec(float_address),
                  RELOC_DISP32);
 }
@@ -2481,14 +2447,14 @@
   %{
     // JMP, CALL
     Label* l = $labl$$label;
-    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0);
+    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0);
   %}
 
   enc_class LblShort(label labl)
   %{
     // JMP, CALL
     Label* l = $labl$$label;
-    int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+    int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
     assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
     emit_d8(cbuf, disp);
   %}
@@ -2517,7 +2483,7 @@
     Label* l = $labl$$label;
     $$$emit8$primary;
     emit_cc(cbuf, $secondary, $cop$$cmpcode);
-    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0);
+    emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0);
   %}
 
   enc_class JccShort (cmpOp cop, label labl)
@@ -2525,7 +2491,7 @@
   // JCC
     Label *l = $labl$$label;
     emit_cc(cbuf, $primary, $cop$$cmpcode);
-    int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+    int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
     assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
     emit_d8(cbuf, disp);
   %}
@@ -2609,22 +2575,22 @@
   %{
     // CALL Java_To_Interpreter
     // This is the instruction starting address for relocation info.
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
     // CALL directly to the runtime
     emit_d32_reloc(cbuf,
-                   (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+                   (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
                    runtime_call_Relocation::spec(),
                    RELOC_DISP32);
   %}
 
   enc_class preserve_SP %{
-    debug_only(int off0 = cbuf.code_size());
+    debug_only(int off0 = cbuf.insts_size());
     MacroAssembler _masm(&cbuf);
     // RBP is preserved across all calls, even compiled calls.
     // Use it to preserve RSP in places where the callee might change the SP.
     __ movptr(rbp_mh_SP_save, rsp);
-    debug_only(int off1 = cbuf.code_size());
+    debug_only(int off1 = cbuf.insts_size());
     assert(off1 - off0 == preserve_SP_size(), "correct size prediction");
   %}
 
@@ -2638,22 +2604,22 @@
     // JAVA STATIC CALL
     // CALL to fixup routine.  Fixup routine uses ScopeDesc info to
     // determine who we intended to call.
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
 
     if (!_method) {
       emit_d32_reloc(cbuf,
-                     (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+                     (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
                      runtime_call_Relocation::spec(),
                      RELOC_DISP32);
     } else if (_optimized_virtual) {
       emit_d32_reloc(cbuf,
-                     (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+                     (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
                      opt_virtual_call_Relocation::spec(),
                      RELOC_DISP32);
     } else {
       emit_d32_reloc(cbuf,
-                     (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+                     (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
                      static_call_Relocation::spec(),
                      RELOC_DISP32);
     }
@@ -2669,7 +2635,7 @@
     // !!!!!
     // Generate  "movq rax, -1", placeholder instruction to load oop-info
     // emit_call_dynamic_prologue( cbuf );
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
 
     // movq rax, -1
     emit_opcode(cbuf, Assembler::REX_W);
@@ -2677,13 +2643,13 @@
     emit_d64_reloc(cbuf,
                    (int64_t) Universe::non_oop_word(),
                    oop_Relocation::spec_for_immediate(), RELOC_IMM64);
-    address virtual_call_oop_addr = cbuf.inst_mark();
+    address virtual_call_oop_addr = cbuf.insts_mark();
     // CALL to fixup routine.  Fixup routine uses ScopeDesc info to determine
     // who we intended to call.
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
     emit_d32_reloc(cbuf,
-                   (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4),
+                   (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
                    virtual_call_Relocation::spec(virtual_call_oop_addr),
                    RELOC_DISP32);
   %}
@@ -2697,7 +2663,7 @@
     // assert(-0x80 <= disp && disp < 0x80, "compiled_code_offset isn't small");
 
     // callq *disp(%rax)
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     $$$emit8$primary;
     if (disp < 0x80) {
       emit_rm(cbuf, 0x01, $secondary, RAX_enc); // R/M byte
@@ -3729,10 +3695,10 @@
 
   enc_class enc_rethrow()
   %{
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0xE9); // jmp entry
     emit_d32_reloc(cbuf,
-                   (int) (OptoRuntime::rethrow_stub() - cbuf.code_end() - 4),
+                   (int) (OptoRuntime::rethrow_stub() - cbuf.insts_end() - 4),
                    runtime_call_Relocation::spec(),
                    RELOC_DISP32);
   %}
@@ -3742,7 +3708,7 @@
     int dstenc = $dst$$reg;
     address signmask_address = (address) StubRoutines::x86::float_sign_mask();
 
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     if (dstenc >= 8) {
       emit_opcode(cbuf, Assembler::REX_R);
       dstenc -= 8;
@@ -3759,7 +3725,7 @@
     int dstenc = $dst$$reg;
     address signmask_address = (address) StubRoutines::x86::double_sign_mask();
 
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0x66);
     if (dstenc >= 8) {
       emit_opcode(cbuf, Assembler::REX_R);
@@ -3777,7 +3743,7 @@
     int dstenc = $dst$$reg;
     address signflip_address = (address) StubRoutines::x86::float_sign_flip();
 
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     if (dstenc >= 8) {
       emit_opcode(cbuf, Assembler::REX_R);
       dstenc -= 8;
@@ -3794,7 +3760,7 @@
     int dstenc = $dst$$reg;
     address signflip_address = (address) StubRoutines::x86::double_sign_flip();
 
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0x66);
     if (dstenc >= 8) {
       emit_opcode(cbuf, Assembler::REX_R);
@@ -3846,11 +3812,11 @@
     encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes
 
     // call f2i_fixup
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0xE8);
     emit_d32_reloc(cbuf,
                    (int)
-                   (StubRoutines::x86::f2i_fixup() - cbuf.code_end() - 4),
+                   (StubRoutines::x86::f2i_fixup() - cbuf.insts_end() - 4),
                    runtime_call_Relocation::spec(),
                    RELOC_DISP32);
 
@@ -3870,7 +3836,7 @@
     address const_address = (address) StubRoutines::x86::double_sign_flip();
 
     // cmpq $dst, [0x8000000000000000]
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, dstenc < 8 ? Assembler::REX_W : Assembler::REX_WR);
     emit_opcode(cbuf, 0x39);
     // XXX reg_mem doesn't support RIP-relative addressing yet
@@ -3904,11 +3870,11 @@
     encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes
 
     // call f2l_fixup
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0xE8);
     emit_d32_reloc(cbuf,
                    (int)
-                   (StubRoutines::x86::f2l_fixup() - cbuf.code_end() - 4),
+                   (StubRoutines::x86::f2l_fixup() - cbuf.insts_end() - 4),
                    runtime_call_Relocation::spec(),
                    RELOC_DISP32);
 
@@ -3960,11 +3926,11 @@
     encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes
 
     // call d2i_fixup
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0xE8);
     emit_d32_reloc(cbuf,
                    (int)
-                   (StubRoutines::x86::d2i_fixup() - cbuf.code_end() - 4),
+                   (StubRoutines::x86::d2i_fixup() - cbuf.insts_end() - 4),
                    runtime_call_Relocation::spec(),
                    RELOC_DISP32);
 
@@ -3984,7 +3950,7 @@
     address const_address = (address) StubRoutines::x86::double_sign_flip();
 
     // cmpq $dst, [0x8000000000000000]
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, dstenc < 8 ? Assembler::REX_W : Assembler::REX_WR);
     emit_opcode(cbuf, 0x39);
     // XXX reg_mem doesn't support RIP-relative addressing yet
@@ -4018,11 +3984,11 @@
     encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes
 
     // call d2l_fixup
-    cbuf.set_inst_mark();
+    cbuf.set_insts_mark();
     emit_opcode(cbuf, 0xE8);
     emit_d32_reloc(cbuf,
                    (int)
-                   (StubRoutines::x86::d2l_fixup() - cbuf.code_end() - 4),
+                   (StubRoutines::x86::d2l_fixup() - cbuf.insts_end() - 4),
                    runtime_call_Relocation::spec(),
                    RELOC_DISP32);
 
@@ -4042,11 +4008,11 @@
   %{
     // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes
     // XXX reg_mem doesn't support RIP-relative addressing yet
-    cbuf.set_inst_mark();
-    cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_type, 0); // XXX
+    cbuf.set_insts_mark();
+    cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_type, 0); // XXX
     emit_opcode(cbuf, 0x85); // testl
     emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5
-    // cbuf.inst_mark() is beginning of instruction
+    // cbuf.insts_mark() is beginning of instruction
     emit_d32_reloc(cbuf, os::get_polling_page());
 //                    relocInfo::poll_type,
   %}
@@ -12304,7 +12270,7 @@
     int parity_disp = -1;
     if ($cop$$cmpcode == Assembler::notEqual) {
        // the two jumps 6 bytes apart so the jump distances are too
-       parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0;
+       parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
     } else if ($cop$$cmpcode == Assembler::equal) {
        parity_disp = 6;
     } else {
@@ -12313,7 +12279,7 @@
     emit_d32(cbuf, parity_disp);
     $$$emit8$primary;
     emit_cc(cbuf, $secondary, $cop$$cmpcode);
-    int disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0;
+    int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0;
     emit_d32(cbuf, disp);
   %}
   ins_pipe(pipe_jcc);
@@ -12508,7 +12474,7 @@
     emit_cc(cbuf, $primary, Assembler::parity);
     int parity_disp = -1;
     if ($cop$$cmpcode == Assembler::notEqual) {
-      parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+      parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
     } else if ($cop$$cmpcode == Assembler::equal) {
       parity_disp = 2;
     } else {
@@ -12516,7 +12482,7 @@
     }
     emit_d8(cbuf, parity_disp);
     emit_cc(cbuf, $primary, $cop$$cmpcode);
-    int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0;
+    int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0;
     emit_d8(cbuf, disp);
     assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp");
     assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp");
--- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -230,7 +230,8 @@
 
   GEN_OFFS(CodeBlob, _name);
   GEN_OFFS(CodeBlob, _header_size);
-  GEN_OFFS(CodeBlob, _instructions_offset);
+  GEN_OFFS(CodeBlob, _content_offset);
+  GEN_OFFS(CodeBlob, _code_offset);
   GEN_OFFS(CodeBlob, _data_offset);
   GEN_OFFS(CodeBlob, _frame_size);
   printf("\n");
--- a/hotspot/src/os/solaris/dtrace/libjvm_db.c	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c	Wed Aug 25 05:27:54 2010 -0700
@@ -124,7 +124,7 @@
   uint64_t pc_desc;
 
   int32_t  orig_pc_offset;      /* _orig_pc_offset */
-  int32_t  instrs_beg;          /* _instructions_offset */
+  int32_t  instrs_beg;          /* _code_offset */
   int32_t  instrs_end;
   int32_t  deopt_beg;           /* _deoptimize_offset */
   int32_t  scopes_data_beg;     /* _scopes_data_offset */
@@ -587,7 +587,7 @@
       fprintf(stderr, "\t nmethod_info: BEGIN \n");
 
   /* Instructions */
-  err = ps_pread(J->P, nm + OFFSET_CodeBlob_instructions_offset, &N->instrs_beg, SZ32);
+  err = ps_pread(J->P, nm + OFFSET_CodeBlob_code_offset, &N->instrs_beg, SZ32);
   CHECK_FAIL(err);
   err = ps_pread(J->P, nm + OFFSET_CodeBlob_data_offset, &N->instrs_end, SZ32);
   CHECK_FAIL(err);
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -149,8 +149,8 @@
   // If we are using Vectored Exceptions we don't need this registration
   if (UseVectoredExceptions) return true;
 
-  BufferBlob* b = BufferBlob::create("CodeCache Exception Handler", sizeof (DynamicCodeData));
-  CodeBuffer cb(b->instructions_begin(), b->instructions_size());
+  BufferBlob* blob = BufferBlob::create("CodeCache Exception Handler", sizeof(DynamicCodeData));
+  CodeBuffer cb(blob);
   MacroAssembler* masm = new MacroAssembler(&cb);
   pDCD = (pDynamicCodeData) masm->pc();
 
--- a/hotspot/src/os_cpu/windows_x86/vm/windows_x86_32.ad	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/windows_x86_32.ad	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -141,8 +141,7 @@
 
 // emit an interrupt that is caught by the debugger
 void emit_break(CodeBuffer &cbuf) {
-  *(cbuf.code_end()) = (unsigned char)(0xcc);
-  cbuf.set_code_end(cbuf.code_end() + 1);
+  cbuf.insts()->emit_int8((unsigned char) 0xcc);
 }
 
 void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
--- a/hotspot/src/os_cpu/windows_x86/vm/windows_x86_64.ad	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/windows_x86_64.ad	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -144,8 +144,7 @@
 
 // emit an interrupt that is caught by the debugger
 void emit_break(CodeBuffer &cbuf) {
-  *(cbuf.code_end()) = (unsigned char)(0xcc);
-  cbuf.set_code_end(cbuf.code_end() + 1);
+  cbuf.insts()->emit_int8((unsigned char) 0xcc);
 }
 
 void MachBreakpointNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
--- a/hotspot/src/share/vm/adlc/output_c.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/adlc/output_c.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -2482,7 +2482,7 @@
   }
 
   // Save current instruction's starting address (helps with relocation).
-  fprintf( fp, "    cbuf.set_inst_mark();\n");
+  fprintf(fp, "    cbuf.set_insts_mark();\n");
 
   // // // idx0 is only needed for syntactic purposes and only by "storeSSI"
   // fprintf( fp, "    unsigned idx0  = 0;\n");
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,12 +74,11 @@
 
 typedef CodeBuffer::csize_t csize_t;  // file-local definition
 
-// external buffer, in a predefined CodeBlob or other buffer area
+// External buffer, in a predefined CodeBlob.
 // Important: The code_start must be taken exactly, and not realigned.
-CodeBuffer::CodeBuffer(address code_start, csize_t code_size) {
-  assert(code_start != NULL, "sanity");
+CodeBuffer::CodeBuffer(CodeBlob* blob) {
   initialize_misc("static buffer");
-  initialize(code_start, code_size);
+  initialize(blob->content_begin(), blob->content_size());
   assert(verify_section_allocation(), "initial use of buffer OK");
 }
 
@@ -99,7 +98,7 @@
   // Set up various pointers into the blob.
   initialize(_total_start, _total_size);
 
-  assert((uintptr_t)code_begin() % CodeEntryAlignment == 0, "instruction start not code entry aligned");
+  assert((uintptr_t)insts_begin() % CodeEntryAlignment == 0, "instruction start not code entry aligned");
 
   pd_initialize();
 
@@ -192,8 +191,8 @@
 void CodeBuffer::set_blob(BufferBlob* blob) {
   _blob = blob;
   if (blob != NULL) {
-    address start = blob->instructions_begin();
-    address end   = blob->instructions_end();
+    address start = blob->content_begin();
+    address end   = blob->content_end();
     // Round up the starting address.
     int align = _insts.alignment();
     start += (-(intptr_t)start) & (align-1);
@@ -422,21 +421,21 @@
 /// The pattern is the same for all functions.
 /// We iterate over all the sections, padding each to alignment.
 
-csize_t CodeBuffer::total_code_size() const {
-  csize_t code_size_so_far = 0;
+csize_t CodeBuffer::total_content_size() const {
+  csize_t size_so_far = 0;
   for (int n = 0; n < (int)SECT_LIMIT; n++) {
     const CodeSection* cs = code_section(n);
     if (cs->is_empty())  continue;  // skip trivial section
-    code_size_so_far = cs->align_at_start(code_size_so_far);
-    code_size_so_far += cs->size();
+    size_so_far = cs->align_at_start(size_so_far);
+    size_so_far += cs->size();
   }
-  return code_size_so_far;
+  return size_so_far;
 }
 
 void CodeBuffer::compute_final_layout(CodeBuffer* dest) const {
   address buf = dest->_total_start;
   csize_t buf_offset = 0;
-  assert(dest->_total_size >= total_code_size(), "must be big enough");
+  assert(dest->_total_size >= total_content_size(), "must be big enough");
 
   {
     // not sure why this is here, but why not...
@@ -489,7 +488,7 @@
   }
 
   // Done calculating sections; did it come out to the right end?
-  assert(buf_offset == total_code_size(), "sanity");
+  assert(buf_offset == total_content_size(), "sanity");
   assert(dest->verify_section_allocation(), "final configuration works");
 }
 
@@ -515,7 +514,7 @@
 
 csize_t CodeBuffer::total_relocation_size() const {
   csize_t lsize = copy_relocations_to(NULL);  // dry run only
-  csize_t csize = total_code_size();
+  csize_t csize = total_content_size();
   csize_t total = RelocIterator::locs_and_index_size(csize, lsize);
   return (csize_t) align_size_up(total, HeapWordSize);
 }
@@ -601,7 +600,7 @@
     buf_offset += sizeof(relocInfo);
   }
 
-  assert(code_end_so_far == total_code_size(), "sanity");
+  assert(code_end_so_far == total_content_size(), "sanity");
 
   // Account for index:
   if (buf != NULL) {
@@ -621,9 +620,8 @@
   }
 #endif //PRODUCT
 
-  CodeBuffer dest(dest_blob->instructions_begin(),
-                  dest_blob->instructions_size());
-  assert(dest_blob->instructions_size() >= total_code_size(), "good sizing");
+  CodeBuffer dest(dest_blob);
+  assert(dest_blob->content_size() >= total_content_size(), "good sizing");
   this->compute_final_layout(&dest);
   relocate_code_to(&dest);
 
@@ -631,11 +629,10 @@
   dest_blob->set_comments(_comments);
 
   // Done moving code bytes; were they the right size?
-  assert(round_to(dest.total_code_size(), oopSize) == dest_blob->instructions_size(), "sanity");
+  assert(round_to(dest.total_content_size(), oopSize) == dest_blob->content_size(), "sanity");
 
   // Flush generated code
-  ICache::invalidate_range(dest_blob->instructions_begin(),
-                           dest_blob->instructions_size());
+  ICache::invalidate_range(dest_blob->code_begin(), dest_blob->code_size());
 }
 
 // Move all my code into another code buffer.
@@ -844,8 +841,8 @@
   if (tstart == badAddress)  return true;  // smashed by set_blob(NULL)
   address tend   = tstart + _total_size;
   if (_blob != NULL) {
-    assert(tstart >= _blob->instructions_begin(), "sanity");
-    assert(tend   <= _blob->instructions_end(),   "sanity");
+    assert(tstart >= _blob->content_begin(), "sanity");
+    assert(tend   <= _blob->content_end(),   "sanity");
   }
   address tcheck = tstart;  // advancing pointer to verify disjointness
   for (int n = 0; n < (int)SECT_LIMIT; n++) {
@@ -981,13 +978,13 @@
 
 
 void CodeBuffer::decode() {
-  Disassembler::decode(decode_begin(), code_end());
-  _decode_begin = code_end();
+  Disassembler::decode(decode_begin(), insts_end());
+  _decode_begin = insts_end();
 }
 
 
 void CodeBuffer::skip_decode() {
-  _decode_begin = code_end();
+  _decode_begin = insts_end();
 }
 
 
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp	Wed Aug 25 05:27:54 2010 -0700
@@ -186,6 +186,12 @@
     _locs_point = pc;
   }
 
+  // Code emission
+  void emit_int8 (int8_t  x) { *((int8_t*)  end()) = x; set_end(end() + 1); }
+  void emit_int16(int16_t x) { *((int16_t*) end()) = x; set_end(end() + 2); }
+  void emit_int32(int32_t x) { *((int32_t*) end()) = x; set_end(end() + 4); }
+  void emit_int64(int64_t x) { *((int64_t*) end()) = x; set_end(end() + 8); }
+
   // Share a scratch buffer for relocinfo.  (Hacky; saves a resource allocation.)
   void initialize_shared_locs(relocInfo* buf, int length);
 
@@ -374,9 +380,17 @@
 
  public:
   // (1) code buffer referring to pre-allocated instruction memory
-  CodeBuffer(address code_start, csize_t code_size);
+  CodeBuffer(address code_start, csize_t code_size) {
+    assert(code_start != NULL, "sanity");
+    initialize_misc("static buffer");
+    initialize(code_start, code_size);
+    assert(verify_section_allocation(), "initial use of buffer OK");
+  }
 
-  // (2) code buffer allocating codeBlob memory for code & relocation
+  // (2) CodeBuffer referring to pre-allocated CodeBlob.
+  CodeBuffer(CodeBlob* blob);
+
+  // (3) code buffer allocating codeBlob memory for code & relocation
   // info but with lazy initialization.  The name must be something
   // informative.
   CodeBuffer(const char* name) {
@@ -384,7 +398,7 @@
   }
 
 
-  // (3) code buffer allocating codeBlob memory for code & relocation
+  // (4) code buffer allocating codeBlob memory for code & relocation
   // info.  The name must be something informative and code_size must
   // include both code and stubs sizes.
   CodeBuffer(const char* name, csize_t code_size, csize_t locs_size) {
@@ -394,8 +408,8 @@
 
   ~CodeBuffer();
 
-  // Initialize a CodeBuffer constructed using constructor 2.  Using
-  // constructor 3 is equivalent to calling constructor 2 and then
+  // Initialize a CodeBuffer constructed using constructor 3.  Using
+  // constructor 4 is equivalent to calling constructor 3 and then
   // calling this method.  It's been factored out for convenience of
   // construction.
   void initialize(csize_t code_size, csize_t locs_size);
@@ -438,36 +452,37 @@
   void   free_blob();                       // Free the blob, if we own one.
 
   // Properties relative to the insts section:
-  address code_begin() const            { return _insts.start(); }
-  address code_end() const              { return _insts.end();   }
-  void set_code_end(address end)        { _insts.set_end(end); }
-  address code_limit() const            { return _insts.limit(); }
-  address inst_mark() const             { return _insts.mark(); }
-  void set_inst_mark()                  { _insts.set_mark(); }
-  void clear_inst_mark()                { _insts.clear_mark(); }
+  address       insts_begin() const      { return _insts.start();      }
+  address       insts_end() const        { return _insts.end();        }
+  void      set_insts_end(address end)   {        _insts.set_end(end); }
+  address       insts_limit() const      { return _insts.limit();      }
+  address       insts_mark() const       { return _insts.mark();       }
+  void      set_insts_mark()             {        _insts.set_mark();   }
+  void    clear_insts_mark()             {        _insts.clear_mark(); }
 
   // is there anything in the buffer other than the current section?
-  bool    is_pure() const               { return code_size() == total_code_size(); }
+  bool    is_pure() const                { return insts_size() == total_content_size(); }
 
   // size in bytes of output so far in the insts sections
-  csize_t code_size() const             { return _insts.size(); }
+  csize_t insts_size() const             { return _insts.size(); }
 
-  // same as code_size(), except that it asserts there is no non-code here
-  csize_t pure_code_size() const        { assert(is_pure(), "no non-code");
-                                          return code_size(); }
+  // same as insts_size(), except that it asserts there is no non-code here
+  csize_t pure_insts_size() const        { assert(is_pure(), "no non-code");
+                                           return insts_size(); }
   // capacity in bytes of the insts sections
-  csize_t code_capacity() const         { return _insts.capacity(); }
+  csize_t insts_capacity() const         { return _insts.capacity(); }
 
   // number of bytes remaining in the insts section
-  csize_t code_remaining() const        { return _insts.remaining(); }
+  csize_t insts_remaining() const        { return _insts.remaining(); }
 
   // is a given address in the insts section?  (2nd version is end-inclusive)
-  bool code_contains(address pc) const  { return _insts.contains(pc); }
-  bool code_contains2(address pc) const { return _insts.contains2(pc); }
+  bool insts_contains(address pc) const  { return _insts.contains(pc); }
+  bool insts_contains2(address pc) const { return _insts.contains2(pc); }
 
-  // allocated size of code in all sections, when aligned and concatenated
-  // (this is the eventual state of the code in its final CodeBlob)
-  csize_t total_code_size() const;
+  // Allocated size in all sections, when aligned and concatenated
+  // (this is the eventual state of the content in its final
+  // CodeBlob).
+  csize_t total_content_size() const;
 
   // combined offset (relative to start of insts) of given address,
   // as eventually found in the final CodeBlob
--- a/hotspot/src/share/vm/c1/c1_Compilation.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compilation.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -454,8 +454,7 @@
 , _allocator(NULL)
 , _next_id(0)
 , _next_block_id(0)
-, _code(buffer_blob->instructions_begin(),
-        buffer_blob->instructions_size())
+, _code(buffer_blob)
 , _current_instruction(NULL)
 #ifndef PRODUCT
 , _last_instruction_printed(NULL)
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -118,8 +118,7 @@
   assert(0 <= id && id < number_of_ids, "illegal stub id");
   ResourceMark rm;
   // create code buffer for code storage
-  CodeBuffer code(buffer_blob->instructions_begin(),
-                  buffer_blob->instructions_size());
+  CodeBuffer code(buffer_blob);
 
   Compilation::setup_code_buffer(&code, 0);
 
--- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
 
   // stubs
   static CodeBlob* blob_for (StubID id);
-  static address   entry_for(StubID id)          { return blob_for(id)->instructions_begin(); }
+  static address   entry_for(StubID id)          { return blob_for(id)->code_begin(); }
   static const char* name_for (StubID id);
   static const char* name_for_address(address entry);
 
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -922,12 +922,12 @@
 
 // ------------------------------------------------------------------
 // ciMethod::instructions_size
-// This is a rough metric for "fat" methods, compared
-// before inlining with InlineSmallCode.
-// The CodeBlob::instructions_size accessor includes
-// junk like exception handler, stubs, and constant table,
-// which are not highly relevant to an inlined method.
-// So we use the more specific accessor nmethod::code_size.
+//
+// This is a rough metric for "fat" methods, compared before inlining
+// with InlineSmallCode.  The CodeBlob::code_size accessor includes
+// junk like exception handler, stubs, and constant table, which are
+// not highly relevant to an inlined method.  So we use the more
+// specific accessor nmethod::insts_size.
 int ciMethod::instructions_size() {
   GUARDED_VM_ENTRY(
     nmethod* code = get_methodOop()->code();
@@ -939,7 +939,7 @@
         (TieredCompilation && code->compiler() != NULL && code->compiler()->is_c1())) {
       return 0;
     }
-    return code->code_end() - code->verified_entry_point();
+    return code->insts_end() - code->verified_entry_point();
   )
 }
 
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -39,7 +39,7 @@
   size += round_to(cb->total_relocation_size(), oopSize);
   // align the size to CodeEntryAlignment
   size = align_code_offset(size);
-  size += round_to(cb->total_code_size(), oopSize);
+  size += round_to(cb->total_content_size(), oopSize);
   size += round_to(cb->total_oop_size(), oopSize);
   return size;
 }
@@ -47,8 +47,8 @@
 
 // Creates a simple CodeBlob. Sets up the size of the different regions.
 CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) {
-  assert(size == round_to(size, oopSize), "unaligned size");
-  assert(locs_size == round_to(locs_size, oopSize), "unaligned size");
+  assert(size        == round_to(size,        oopSize), "unaligned size");
+  assert(locs_size   == round_to(locs_size,   oopSize), "unaligned size");
   assert(header_size == round_to(header_size, oopSize), "unaligned size");
   assert(!UseRelocIndex, "no space allocated for reloc index yet");
 
@@ -64,7 +64,8 @@
   _frame_complete_offset = frame_complete;
   _header_size           = header_size;
   _relocation_size       = locs_size;
-  _instructions_offset   = align_code_offset(header_size + locs_size);
+  _content_offset        = align_code_offset(header_size + _relocation_size);
+  _code_offset           = _content_offset;
   _data_offset           = size;
   _frame_size            =  0;
   set_oop_maps(NULL);
@@ -82,7 +83,7 @@
   int         frame_size,
   OopMapSet*  oop_maps
 ) {
-  assert(size == round_to(size, oopSize), "unaligned size");
+  assert(size        == round_to(size,        oopSize), "unaligned size");
   assert(header_size == round_to(header_size, oopSize), "unaligned size");
 
   _name                  = name;
@@ -90,8 +91,9 @@
   _frame_complete_offset = frame_complete;
   _header_size           = header_size;
   _relocation_size       = round_to(cb->total_relocation_size(), oopSize);
-  _instructions_offset   = align_code_offset(header_size + _relocation_size);
-  _data_offset           = _instructions_offset + round_to(cb->total_code_size(), oopSize);
+  _content_offset        = align_code_offset(header_size + _relocation_size);
+  _code_offset           = _content_offset + cb->total_offset_of(cb->insts()->start());
+  _data_offset           = _content_offset + round_to(cb->total_content_size(), oopSize);
   assert(_data_offset <= size, "codeBlob is too small");
 
   cb->copy_code_and_locs_to(this);
@@ -127,9 +129,8 @@
 
 
 OopMap* CodeBlob::oop_map_for_return_address(address return_address) {
-  address pc = return_address ;
-  assert (oop_maps() != NULL, "nope");
-  return oop_maps()->find_map_at_offset ((intptr_t) pc - (intptr_t) instructions_begin());
+  assert(oop_maps() != NULL, "nope");
+  return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());
 }
 
 
@@ -284,12 +285,12 @@
     jio_snprintf(stub_id, sizeof(stub_id), "RuntimeStub - %s", stub_name);
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, stub_id, stub);
-      Disassembler::decode(stub->instructions_begin(), stub->instructions_end());
+      Disassembler::decode(stub->code_begin(), stub->code_end());
     }
-    Forte::register_stub(stub_id, stub->instructions_begin(), stub->instructions_end());
+    Forte::register_stub(stub_id, stub->code_begin(), stub->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated(stub_name, stub->instructions_begin(), stub->instructions_end());
+      JvmtiExport::post_dynamic_code_generated(stub_name, stub->code_begin(), stub->code_end());
     }
   }
 
@@ -355,17 +356,15 @@
   // Do not hold the CodeCache lock during name formatting.
   if (blob != NULL) {
     char blob_id[256];
-    jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->instructions_begin());
+    jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->code_begin());
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
-      Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+      Disassembler::decode(blob->code_begin(), blob->code_end());
     }
-    Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+    Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob",
-                                               blob->instructions_begin(),
-                                               blob->instructions_end());
+      JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob", blob->code_begin(), blob->code_end());
     }
   }
 
@@ -412,17 +411,15 @@
   // Do not hold the CodeCache lock during name formatting.
   if (blob != NULL) {
     char blob_id[256];
-    jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->instructions_begin());
+    jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->code_begin());
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
-      Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+      Disassembler::decode(blob->code_begin(), blob->code_end());
     }
-    Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+    Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob",
-                                               blob->instructions_begin(),
-                                               blob->instructions_end());
+      JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob", blob->code_begin(), blob->code_end());
     }
   }
 
@@ -471,17 +468,15 @@
   // We do not need to hold the CodeCache lock during name formatting
   if (blob != NULL) {
     char blob_id[256];
-    jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->instructions_begin());
+    jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->code_begin());
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
-      Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+      Disassembler::decode(blob->code_begin(), blob->code_end());
     }
-    Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+    Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated("ExceptionBlob",
-                                               blob->instructions_begin(),
-                                               blob->instructions_end());
+      JvmtiExport::post_dynamic_code_generated("ExceptionBlob", blob->code_begin(), blob->code_end());
     }
   }
 
@@ -529,17 +524,15 @@
   // We do not need to hold the CodeCache lock during name formatting.
   if (blob != NULL) {
     char blob_id[256];
-    jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->instructions_begin());
+    jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->code_begin());
     if (PrintStubCode) {
       tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob);
-      Disassembler::decode(blob->instructions_begin(), blob->instructions_end());
+      Disassembler::decode(blob->code_begin(), blob->code_end());
     }
-    Forte::register_stub(blob_id, blob->instructions_begin(), blob->instructions_end());
+    Forte::register_stub(blob_id, blob->code_begin(), blob->code_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated("SafepointBlob",
-                                               blob->instructions_begin(),
-                                               blob->instructions_end());
+      JvmtiExport::post_dynamic_code_generated("SafepointBlob", blob->code_begin(), blob->code_end());
     }
   }
 
--- a/hotspot/src/share/vm/code/codeBlob.hpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.hpp	Wed Aug 25 05:27:54 2010 -0700
@@ -35,7 +35,8 @@
 // Layout:
 //   - header
 //   - relocation
-//   - instruction space
+//   - content space
+//     - instruction space
 //   - data space
 class DeoptimizationBlob;
 
@@ -48,7 +49,8 @@
   int        _size;                              // total size of CodeBlob in bytes
   int        _header_size;                       // size of header (depends on subclass)
   int        _relocation_size;                   // size of relocation
-  int        _instructions_offset;               // offset to where instructions region begins
+  int        _content_offset;                    // offset to where content region begins (this includes consts, insts, stubs)
+  int        _code_offset;                       // offset to where instructions region begins (this includes insts, stubs)
   int        _frame_complete_offset;             // instruction offsets in [0.._frame_complete_offset) have
                                                  // not finished setting up their frame. Beware of pc's in
                                                  // that range. There is a similar range(s) on returns
@@ -106,31 +108,36 @@
   address    header_end() const                  { return ((address)   this) + _header_size; };
   relocInfo* relocation_begin() const            { return (relocInfo*) header_end(); };
   relocInfo* relocation_end() const              { return (relocInfo*)(header_end()   + _relocation_size); }
-  address    instructions_begin() const          { return (address)    header_begin() + _instructions_offset;  }
-  address    instructions_end() const            { return (address)    header_begin() + _data_offset; }
+  address    content_begin() const               { return (address)    header_begin() + _content_offset; }
+  address    content_end() const                 { return (address)    header_begin() + _data_offset; }
+  address    code_begin() const                  { return (address)    header_begin() + _code_offset; }
+  address    code_end() const                    { return (address)    header_begin() + _data_offset; }
   address    data_begin() const                  { return (address)    header_begin() + _data_offset; }
   address    data_end() const                    { return (address)    header_begin() + _size; }
 
   // Offsets
   int relocation_offset() const                  { return _header_size; }
-  int instructions_offset() const                { return _instructions_offset; }
+  int content_offset() const                     { return _content_offset; }
+  int code_offset() const                        { return _code_offset; }
   int data_offset() const                        { return _data_offset; }
 
   // Sizes
   int size() const                               { return _size; }
   int header_size() const                        { return _header_size; }
   int relocation_size() const                    { return (address) relocation_end() - (address) relocation_begin(); }
-  int instructions_size() const                  { return instructions_end() - instructions_begin();  }
-  int data_size() const                          { return data_end() - data_begin(); }
+  int content_size() const                       { return           content_end()    -           content_begin();    }
+  int code_size() const                          { return           code_end()       -           code_begin();       }
+  int data_size() const                          { return           data_end()       -           data_begin();       }
 
   // Containment
-  bool blob_contains(address addr) const         { return header_begin()       <= addr && addr < data_end(); }
+  bool blob_contains(address addr) const         { return header_begin()       <= addr && addr < data_end();       }
   bool relocation_contains(relocInfo* addr) const{ return relocation_begin()   <= addr && addr < relocation_end(); }
-  bool instructions_contains(address addr) const { return instructions_begin() <= addr && addr < instructions_end(); }
-  bool data_contains(address addr) const         { return data_begin()         <= addr && addr < data_end(); }
-  bool contains(address addr) const              { return instructions_contains(addr); }
-  bool is_frame_complete_at(address addr) const  { return instructions_contains(addr) &&
-                                                          addr >= instructions_begin() + _frame_complete_offset; }
+  bool content_contains(address addr) const      { return content_begin()      <= addr && addr < content_end();    }
+  bool code_contains(address addr) const         { return code_begin()         <= addr && addr < code_end();       }
+  bool data_contains(address addr) const         { return data_begin()         <= addr && addr < data_end();       }
+  bool contains(address addr) const              { return content_contains(addr); }
+  bool is_frame_complete_at(address addr) const  { return code_contains(addr) &&
+                                                          addr >= code_begin() + _frame_complete_offset; }
 
   // CodeCache support: really only used by the nmethods, but in order to get
   // asserts and certain bookkeeping to work in the CodeCache they are defined
@@ -169,7 +176,7 @@
 
   // Print the comment associated with offset on stream, if there is one
   virtual void print_block_comment(outputStream* stream, address block_begin) {
-    intptr_t offset = (intptr_t)(block_begin - instructions_begin());
+    intptr_t offset = (intptr_t)(block_begin - code_begin());
     _comments.print_block_comment(stream, offset);
   }
 
@@ -286,7 +293,7 @@
   // GC support
   bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; }
 
-  address entry_point()                          { return instructions_begin(); }
+  address entry_point()                          { return code_begin(); }
 
   // GC/Verification support
   void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f)  { /* nothing to do */ }
@@ -313,13 +320,15 @@
      OopMapSet*  oop_maps
    )
    : CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps)
-   {};
+  {};
 
-   bool is_alive() const                         { return true; }
+  address entry_point()                          { return code_begin(); }
 
-   void verify(); // does nothing
-   void print_on(outputStream* st) const;
-   void print_value_on(outputStream* st) const;
+  bool is_alive() const                          { return true; }
+
+  void verify(); // does nothing
+  void print_on(outputStream* st) const;
+  void print_value_on(outputStream* st) const;
 };
 
 
@@ -376,9 +385,9 @@
   // Printing
   void print_value_on(outputStream* st) const;
 
-  address unpack() const                         { return instructions_begin() + _unpack_offset;           }
-  address unpack_with_exception() const          { return instructions_begin() + _unpack_with_exception;   }
-  address unpack_with_reexecution() const        { return instructions_begin() + _unpack_with_reexecution; }
+  address unpack() const                         { return code_begin() + _unpack_offset;           }
+  address unpack_with_exception() const          { return code_begin() + _unpack_with_exception;   }
+  address unpack_with_reexecution() const        { return code_begin() + _unpack_with_reexecution; }
 
   // Alternate entry point for C1 where the exception and issuing pc
   // are in JavaThread::_exception_oop and JavaThread::_exception_pc
@@ -387,9 +396,9 @@
   // there may be live values in those registers during deopt.
   void set_unpack_with_exception_in_tls_offset(int offset) {
     _unpack_with_exception_in_tls = offset;
-    assert(contains(instructions_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob");
+    assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob");
   }
-  address unpack_with_exception_in_tls() const   { return instructions_begin() + _unpack_with_exception_in_tls;   }
+  address unpack_with_exception_in_tls() const   { return code_begin() + _unpack_with_exception_in_tls; }
 };
 
 
--- a/hotspot/src/share/vm/code/codeCache.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -76,14 +76,14 @@
     relocation_size  += cb->relocation_size();
     if (cb->is_nmethod()) {
       nmethod* nm = cb->as_nmethod_or_null();
-      code_size        += nm->code_size();
+      code_size        += nm->insts_size();
       stub_size        += nm->stub_size();
 
       scopes_oop_size  += nm->oops_size();
       scopes_data_size += nm->scopes_data_size();
       scopes_pcs_size  += nm->scopes_pcs_size();
     } else {
-      code_size        += cb->instructions_size();
+      code_size        += cb->code_size();
     }
   }
 };
@@ -210,7 +210,7 @@
   }
 
   // flush the hardware I-cache
-  ICache::invalidate_range(cb->instructions_begin(), cb->instructions_size());
+  ICache::invalidate_range(cb->content_begin(), cb->content_size());
 }
 
 
@@ -804,8 +804,8 @@
 
       if(nm->method() != NULL && nm->is_java_method()) {
         nmethodJava++;
-        if(nm->code_size() > maxCodeSize) {
-          maxCodeSize = nm->code_size();
+        if (nm->insts_size() > maxCodeSize) {
+          maxCodeSize = nm->insts_size();
         }
       }
     } else if (cb->is_runtime_stub()) {
@@ -830,7 +830,7 @@
     if (cb->is_nmethod()) {
       nmethod* nm = (nmethod*)cb;
       if(nm->is_java_method()) {
-        buckets[nm->code_size() / bucketSize]++;
+        buckets[nm->insts_size() / bucketSize]++;
       }
     }
   }
@@ -896,11 +896,11 @@
     FOR_ALL_BLOBS(p) {
       if (p->is_alive()) {
         number_of_blobs++;
-        code_size += p->instructions_size();
+        code_size += p->code_size();
         OopMapSet* set = p->oop_maps();
         if (set != NULL) {
           number_of_oop_maps += set->size();
-          map_size   += set->heap_size();
+          map_size           += set->heap_size();
         }
       }
     }
--- a/hotspot/src/share/vm/code/exceptionHandlerTable.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -219,8 +219,8 @@
 
 void ImplicitExceptionTable::verify(nmethod *nm) const {
   for (uint i = 0; i < len(); i++) {
-     if ((*adr(i) > (unsigned int)nm->code_size()) ||
-         (*(adr(i)+1) > (unsigned int)nm->code_size()))
+     if ((*adr(i) > (unsigned int)nm->insts_size()) ||
+         (*(adr(i)+1) > (unsigned int)nm->insts_size()))
        fatal(err_msg("Invalid offset in ImplicitExceptionTable at " PTR_FORMAT, _data));
   }
 }
--- a/hotspot/src/share/vm/code/nmethod.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -87,7 +87,7 @@
   int nmethod_count;
   int total_size;
   int relocation_size;
-  int code_size;
+  int insts_size;
   int stub_size;
   int consts_size;
   int scopes_data_size;
@@ -101,7 +101,7 @@
     nmethod_count += 1;
     total_size          += nm->size();
     relocation_size     += nm->relocation_size();
-    code_size           += nm->code_size();
+    insts_size          += nm->insts_size();
     stub_size           += nm->stub_size();
     consts_size         += nm->consts_size();
     oops_size           += nm->oops_size();
@@ -116,7 +116,7 @@
     tty->print_cr("Statistics for %d bytecoded nmethods:", nmethod_count);
     if (total_size != 0)          tty->print_cr(" total in heap  = %d", total_size);
     if (relocation_size != 0)     tty->print_cr(" relocation     = %d", relocation_size);
-    if (code_size != 0)           tty->print_cr(" main code      = %d", code_size);
+    if (insts_size != 0)          tty->print_cr(" main code      = %d", insts_size);
     if (stub_size != 0)           tty->print_cr(" stub code      = %d", stub_size);
     if (consts_size != 0)         tty->print_cr(" constants      = %d", consts_size);
     if (oops_size != 0)           tty->print_cr(" oops           = %d", oops_size);
@@ -130,13 +130,13 @@
   int native_nmethod_count;
   int native_total_size;
   int native_relocation_size;
-  int native_code_size;
+  int native_insts_size;
   int native_oops_size;
   void note_native_nmethod(nmethod* nm) {
     native_nmethod_count += 1;
     native_total_size       += nm->size();
     native_relocation_size  += nm->relocation_size();
-    native_code_size        += nm->code_size();
+    native_insts_size       += nm->insts_size();
     native_oops_size        += nm->oops_size();
   }
   void print_native_nmethod_stats() {
@@ -144,7 +144,7 @@
     tty->print_cr("Statistics for %d native nmethods:", native_nmethod_count);
     if (native_total_size != 0)       tty->print_cr(" N. total size  = %d", native_total_size);
     if (native_relocation_size != 0)  tty->print_cr(" N. relocation  = %d", native_relocation_size);
-    if (native_code_size != 0)        tty->print_cr(" N. main code   = %d", native_code_size);
+    if (native_insts_size != 0)       tty->print_cr(" N. main code   = %d", native_insts_size);
     if (native_oops_size != 0)        tty->print_cr(" N. oops        = %d", native_oops_size);
   }
 
@@ -404,7 +404,7 @@
 
 int nmethod::total_size() const {
   return
-    code_size()          +
+    insts_size()         +
     stub_size()          +
     consts_size()        +
     scopes_data_size()   +
@@ -618,8 +618,8 @@
     _deoptimize_mh_offset    = 0;
     _orig_pc_offset          = 0;
 
+    _consts_offset           = data_offset();
     _stub_offset             = data_offset();
-    _consts_offset           = data_offset();
     _oops_offset             = data_offset();
     _scopes_data_offset      = _oops_offset          + round_to(code_buffer->total_oop_size(), oopSize);
     _scopes_pcs_offset       = _scopes_data_offset;
@@ -629,8 +629,8 @@
     _nmethod_end_offset      = _nul_chk_table_offset;
     _compile_id              = 0;  // default
     _comp_level              = CompLevel_none;
-    _entry_point             = instructions_begin();
-    _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
+    _entry_point             = code_begin()          + offsets->value(CodeOffsets::Entry);
+    _verified_entry_point    = code_begin()          + offsets->value(CodeOffsets::Verified_Entry);
     _osr_entry_point         = NULL;
     _exception_cache         = NULL;
     _pc_desc_cache.reset_to(NULL);
@@ -696,8 +696,8 @@
     _unwind_handler_offset   = -1;
     _trap_offset             = offsets->value(CodeOffsets::Dtrace_trap);
     _orig_pc_offset          = 0;
+    _consts_offset           = data_offset();
     _stub_offset             = data_offset();
-    _consts_offset           = data_offset();
     _oops_offset             = data_offset();
     _scopes_data_offset      = _oops_offset          + round_to(code_buffer->total_oop_size(), oopSize);
     _scopes_pcs_offset       = _scopes_data_offset;
@@ -707,8 +707,8 @@
     _nmethod_end_offset      = _nul_chk_table_offset;
     _compile_id              = 0;  // default
     _comp_level              = CompLevel_none;
-    _entry_point             = instructions_begin();
-    _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
+    _entry_point             = code_begin()          + offsets->value(CodeOffsets::Entry);
+    _verified_entry_point    = code_begin()          + offsets->value(CodeOffsets::Verified_Entry);
     _osr_entry_point         = NULL;
     _exception_cache         = NULL;
     _pc_desc_cache.reset_to(NULL);
@@ -787,18 +787,21 @@
     _comp_level              = comp_level;
     _compiler                = compiler;
     _orig_pc_offset          = orig_pc_offset;
-    _stub_offset             = instructions_offset() + code_buffer->total_offset_of(code_buffer->stubs()->start());
+
+    // Section offsets
+    _consts_offset           = content_offset()      + code_buffer->total_offset_of(code_buffer->consts()->start());
+    _stub_offset             = content_offset()      + code_buffer->total_offset_of(code_buffer->stubs()->start());
 
     // Exception handler and deopt handler are in the stub section
-    _exception_offset        = _stub_offset + offsets->value(CodeOffsets::Exceptions);
-    _deoptimize_offset       = _stub_offset + offsets->value(CodeOffsets::Deopt);
-    _deoptimize_mh_offset    = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
+    _exception_offset        = _stub_offset          + offsets->value(CodeOffsets::Exceptions);
+    _deoptimize_offset       = _stub_offset          + offsets->value(CodeOffsets::Deopt);
+    _deoptimize_mh_offset    = _stub_offset          + offsets->value(CodeOffsets::DeoptMH);
     if (offsets->value(CodeOffsets::UnwindHandler) != -1) {
-      _unwind_handler_offset   = instructions_offset() + offsets->value(CodeOffsets::UnwindHandler);
+      _unwind_handler_offset = code_offset()         + offsets->value(CodeOffsets::UnwindHandler);
     } else {
-      _unwind_handler_offset   = -1;
+      _unwind_handler_offset = -1;
     }
-    _consts_offset           = instructions_offset() + code_buffer->total_offset_of(code_buffer->consts()->start());
+
     _oops_offset             = data_offset();
     _scopes_data_offset      = _oops_offset          + round_to(code_buffer->total_oop_size (), oopSize);
     _scopes_pcs_offset       = _scopes_data_offset   + round_to(debug_info->data_size       (), oopSize);
@@ -807,9 +810,9 @@
     _nul_chk_table_offset    = _handler_table_offset + round_to(handler_table->size_in_bytes(), oopSize);
     _nmethod_end_offset      = _nul_chk_table_offset + round_to(nul_chk_table->size_in_bytes(), oopSize);
 
-    _entry_point             = instructions_begin();
-    _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
-    _osr_entry_point         = instructions_begin() + offsets->value(CodeOffsets::OSR_Entry);
+    _entry_point             = code_begin()          + offsets->value(CodeOffsets::Entry);
+    _verified_entry_point    = code_begin()          + offsets->value(CodeOffsets::Verified_Entry);
+    _osr_entry_point         = code_begin()          + offsets->value(CodeOffsets::OSR_Entry);
     _exception_cache         = NULL;
     _pc_desc_cache.reset_to(scopes_pcs_begin());
 
@@ -878,12 +881,11 @@
     HandleMark hm;
     xtty->begin_elem("nmethod");
     log_identity(xtty);
-    xtty->print(" entry='" INTPTR_FORMAT "' size='%d'",
-                instructions_begin(), size());
+    xtty->print(" entry='" INTPTR_FORMAT "' size='%d'", code_begin(), size());
     xtty->print(" address='" INTPTR_FORMAT "'", (intptr_t) this);
 
     LOG_OFFSET(xtty, relocation);
-    LOG_OFFSET(xtty, code);
+    LOG_OFFSET(xtty, insts);
     LOG_OFFSET(xtty, stub);
     LOG_OFFSET(xtty, consts);
     LOG_OFFSET(xtty, scopes_data);
@@ -1460,7 +1462,7 @@
       moop->name()->utf8_length(),
       moop->signature()->bytes(),
       moop->signature()->utf8_length(),
-      code_begin(), code_size());
+      insts_begin(), insts_size());
 
   if (JvmtiExport::should_post_compiled_method_load() ||
       JvmtiExport::should_post_compiled_method_unload()) {
@@ -1502,7 +1504,7 @@
   if (_jmethod_id != NULL && JvmtiExport::should_post_compiled_method_unload()) {
     assert(!unload_reported(), "already unloaded");
     HandleMark hm;
-    JvmtiExport::post_compiled_method_unload(_jmethod_id, code_begin());
+    JvmtiExport::post_compiled_method_unload(_jmethod_id, insts_begin());
   }
 
   // The JVMTI CompiledMethodUnload event can be enabled or disabled at
@@ -1854,7 +1856,7 @@
   // Adjust the final sentinel downward.
   PcDesc* last_pc = &scopes_pcs_begin()[count-1];
   assert(last_pc->pc_offset() == PcDesc::upper_offset_limit, "sanity");
-  last_pc->set_pc_offset(instructions_size() + 1);
+  last_pc->set_pc_offset(content_size() + 1);
   for (; last_pc + 1 < scopes_pcs_end(); last_pc += 1) {
     // Fill any rounding gaps with copies of the last record.
     last_pc[1] = last_pc[0];
@@ -1894,7 +1896,7 @@
 
 // Finds a PcDesc with real-pc equal to "pc"
 PcDesc* nmethod::find_pc_desc_internal(address pc, bool approximate) {
-  address base_address = instructions_begin();
+  address base_address = code_begin();
   if ((pc < base_address) ||
       (pc - base_address) >= (ptrdiff_t) PcDesc::upper_offset_limit) {
     return NULL;  // PC is wildly out of range
@@ -2042,7 +2044,7 @@
 
 
 bool nmethod::is_patchable_at(address instr_addr) {
-  assert (code_contains(instr_addr), "wrong nmethod used");
+  assert(insts_contains(instr_addr), "wrong nmethod used");
   if (is_zombie()) {
     // a zombie may never be patched
     return false;
@@ -2054,7 +2056,7 @@
 address nmethod::continuation_for_implicit_exception(address pc) {
   // Exception happened outside inline-cache check code => we are inside
   // an active nmethod => use cpc to determine a return address
-  int exception_offset = pc - instructions_begin();
+  int exception_offset = pc - code_begin();
   int cont_offset = ImplicitExceptionTable(this).at( exception_offset );
 #ifdef ASSERT
   if (cont_offset == 0) {
@@ -2075,7 +2077,7 @@
     // Let the normal error handling report the exception
     return NULL;
   }
-  return instructions_begin() + cont_offset;
+  return code_begin() + cont_offset;
 }
 
 
@@ -2334,10 +2336,10 @@
                                               relocation_begin(),
                                               relocation_end(),
                                               relocation_size());
-  if (code_size         () > 0) tty->print_cr(" main code      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
-                                              code_begin(),
-                                              code_end(),
-                                              code_size());
+  if (insts_size        () > 0) tty->print_cr(" main code      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
+                                              insts_begin(),
+                                              insts_end(),
+                                              insts_size());
   if (stub_size         () > 0) tty->print_cr(" stub code      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
                                               stub_begin(),
                                               stub_end(),
@@ -2607,7 +2609,7 @@
   // First, find an oopmap in (begin, end].
   // We use the odd half-closed interval so that oop maps and scope descs
   // which are tied to the byte after a call are printed with the call itself.
-  address base = instructions_begin();
+  address base = code_begin();
   OopMapSet* oms = oop_maps();
   if (oms != NULL) {
     for (int i = 0, imax = oms->size(); i < imax; i++) {
@@ -2695,10 +2697,10 @@
     st->move_to(column);
     st->print(";   {%s}", str);
   }
-  int cont_offset = ImplicitExceptionTable(this).at(begin - instructions_begin());
+  int cont_offset = ImplicitExceptionTable(this).at(begin - code_begin());
   if (cont_offset != 0) {
     st->move_to(column);
-    st->print("; implicit exception: dispatches to " INTPTR_FORMAT, instructions_begin() + cont_offset);
+    st->print("; implicit exception: dispatches to " INTPTR_FORMAT, code_begin() + cont_offset);
   }
 
 }
@@ -2732,7 +2734,7 @@
 }
 
 void nmethod::print_nul_chk_table() {
-  ImplicitExceptionTable(this).print(instructions_begin());
+  ImplicitExceptionTable(this).print(code_begin());
 }
 
 void nmethod::print_statistics() {
--- a/hotspot/src/share/vm/code/nmethod.hpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Wed Aug 25 05:27:54 2010 -0700
@@ -312,7 +312,7 @@
                                      int frame_size);
 
   int trap_offset() const      { return _trap_offset; }
-  address trap_address() const { return code_begin() + _trap_offset; }
+  address trap_address() const { return insts_begin() + _trap_offset; }
 
 #endif // def HAVE_DTRACE_H
 
@@ -336,8 +336,8 @@
   bool is_compiled_by_shark() const;
 
   // boundaries for different parts
-  address code_begin            () const          { return _entry_point; }
-  address code_end              () const          { return           header_begin() + _stub_offset          ; }
+  address insts_begin           () const          { return code_begin(); }
+  address insts_end             () const          { return           header_begin() + _stub_offset          ; }
   address exception_begin       () const          { return           header_begin() + _exception_offset     ; }
   address deopt_handler_begin   () const          { return           header_begin() + _deoptimize_offset    ; }
   address deopt_mh_handler_begin() const          { return           header_begin() + _deoptimize_mh_offset ; }
@@ -361,7 +361,7 @@
   address nul_chk_table_end     () const          { return           header_begin() + _nmethod_end_offset   ; }
 
   // Sizes
-  int code_size         () const                  { return            code_end         () -            code_begin         (); }
+  int insts_size        () const                  { return            insts_end        () -            insts_begin        (); }
   int stub_size         () const                  { return            stub_end         () -            stub_begin         (); }
   int consts_size       () const                  { return            consts_end       () -            consts_begin       (); }
   int oops_size         () const                  { return (address)  oops_end         () - (address)  oops_begin         (); }
@@ -374,7 +374,7 @@
   int total_size        () const;
 
   // Containment
-  bool code_contains         (address addr) const { return code_begin         () <= addr && addr < code_end         (); }
+  bool insts_contains        (address addr) const { return insts_begin        () <= addr && addr < insts_end        (); }
   bool stub_contains         (address addr) const { return stub_begin         () <= addr && addr < stub_end         (); }
   bool consts_contains       (address addr) const { return consts_begin       () <= addr && addr < consts_end       (); }
   bool oops_contains         (oop*    addr) const { return oops_begin         () <= addr && addr < oops_end         (); }
@@ -506,7 +506,7 @@
   void clear_inline_caches();
   void cleanup_inline_caches();
   bool inlinecache_check_contains(address addr) const {
-    return (addr >= instructions_begin() && addr < verified_entry_point());
+    return (addr >= code_begin() && addr < verified_entry_point());
   }
 
   // unlink and deallocate this nmethod
@@ -559,7 +559,7 @@
 
   PcDesc* find_pc_desc(address pc, bool approximate) {
     PcDesc* desc = _pc_desc_cache.last_pc_desc();
-    if (desc != NULL && desc->pc_offset() == pc - instructions_begin()) {
+    if (desc != NULL && desc->pc_offset() == pc - code_begin()) {
       return desc;
     }
     return find_pc_desc_internal(pc, approximate);
--- a/hotspot/src/share/vm/code/pcDesc.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/pcDesc.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -34,7 +34,7 @@
 }
 
 address PcDesc::real_pc(const nmethod* code) const {
-  return code->instructions_begin() + pc_offset();
+  return code->code_begin() + pc_offset();
 }
 
 void PcDesc::print(nmethod* code) {
--- a/hotspot/src/share/vm/code/relocInfo.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/relocInfo.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -128,13 +128,11 @@
   _code    = nm;
   _current = nm->relocation_begin() - 1;
   _end     = nm->relocation_end();
-  _addr    = (address) nm->instructions_begin();
+  _addr    = (address) nm->code_begin();
 
   assert(!has_current(), "just checking");
-  address code_end = nm->instructions_end();
-
-  assert(begin == NULL || begin >= nm->instructions_begin(), "in bounds");
- // FIX THIS  assert(limit == NULL || limit <= code_end,     "in bounds");
+  assert(begin == NULL || begin >= nm->code_begin(), "in bounds");
+  assert(limit == NULL || limit <= nm->code_end(),   "in bounds");
   set_limits(begin, limit);
 }
 
@@ -267,7 +265,7 @@
       // skip ahead
       RelocIndexEntry* index       = (RelocIndexEntry*)_end;
       RelocIndexEntry* index_limit = (RelocIndexEntry*)((address)index + index_size);
-      assert(_addr == _code->instructions_begin(), "_addr must be unadjusted");
+      assert(_addr == _code->code_begin(), "_addr must be unadjusted");
       int card = (begin - _addr) / indexCardSize;
       if (card > 0) {
         if (index+card-1 < index_limit)  index += card-1;
@@ -369,7 +367,7 @@
   CodeBlob* cb = code();
   guarantee(cb != NULL, "must have a code blob");
   if (n == CodeBuffer::SECT_INSTS)
-    return CACHE = cb->instructions_begin();
+    return CACHE = cb->code_begin();
   assert(cb->is_nmethod(), "only nmethods have these sections");
   nmethod* nm = (nmethod*) cb;
   address res = NULL;
@@ -383,7 +381,7 @@
   default:
     ShouldNotReachHere();
   }
-  assert(nm->contains(res) || res == nm->instructions_end(), "tame pointer");
+  assert(nm->contains(res) || res == nm->code_end(), "tame pointer");
   CACHE = res;
   return res;
 #undef CACHE
--- a/hotspot/src/share/vm/code/scopeDesc.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/scopeDesc.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -174,7 +174,7 @@
   print_value_on(st);
   // decode offsets
   if (WizardMode) {
-    st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, _code->instructions_begin());
+    st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, _code->content_begin());
     st->print_cr(" offset:     %d",    _decode_offset);
     st->print_cr(" bci:        %d",    bci());
     st->print_cr(" reexecute:  %s",    should_reexecute() ? "true" : "false");
--- a/hotspot/src/share/vm/code/stubs.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/stubs.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,9 +66,9 @@
     vm_exit_out_of_memory(size, err_msg("CodeCache: no room for %s", name));
   }
   _stub_interface  = stub_interface;
-  _buffer_size     = blob->instructions_size();
-  _buffer_limit    = blob->instructions_size();
-  _stub_buffer     = blob->instructions_begin();
+  _buffer_size     = blob->content_size();
+  _buffer_limit    = blob->content_size();
+  _stub_buffer     = blob->content_begin();
   _queue_begin     = 0;
   _queue_end       = 0;
   _number_of_stubs = 0;
--- a/hotspot/src/share/vm/code/vtableStubs.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/code/vtableStubs.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -48,7 +48,7 @@
     if (blob == NULL) {
       vm_exit_out_of_memory(bytes, "CodeCache: no room for vtable chunks");
     }
-    _chunk = blob->instructions_begin();
+    _chunk = blob->content_begin();
     _chunk_end = _chunk + bytes;
     Forte::register_stub("vtable stub", _chunk, _chunk_end);
     // Notify JVMTI about this stub. The event will be recorded by the enclosing
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -399,7 +399,7 @@
   // <task_done ... stamp='1.234'>  </task>
   nmethod* nm = code();
   log->begin_elem("task_done success='%d' nmsize='%d' count='%d'",
-                  _is_success, nm == NULL ? 0 : nm->instructions_size(),
+                  _is_success, nm == NULL ? 0 : nm->content_size(),
                   method->invocation_count());
   int bec = method->backedge_count();
   if (bec != 0)  log->print(" backedge_count='%d'", bec);
@@ -1847,13 +1847,13 @@
     }
 
     // Collect counts of successful compilations
-    _sum_nmethod_size += code->total_size();
-    _sum_nmethod_code_size += code->code_size();
+    _sum_nmethod_size      += code->total_size();
+    _sum_nmethod_code_size += code->insts_size();
     _total_compile_count++;
 
     if (UsePerfData) {
-      _perf_sum_nmethod_size->inc(code->total_size());
-      _perf_sum_nmethod_code_size->inc(code->code_size());
+      _perf_sum_nmethod_size->inc(     code->total_size());
+      _perf_sum_nmethod_code_size->inc(code->insts_size());
       _perf_total_compile_count->inc();
     }
 
--- a/hotspot/src/share/vm/compiler/disassembler.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -407,7 +407,7 @@
   if (!load_library())  return;
   decode_env env(cb, st);
   env.output()->print_cr("Decoding CodeBlob " INTPTR_FORMAT, cb);
-  env.decode_instructions(cb->instructions_begin(), cb->instructions_end());
+  env.decode_instructions(cb->code_begin(), cb->code_end());
 }
 
 
@@ -424,12 +424,12 @@
   env.output()->print_cr("Code:");
 
 #ifdef SHARK
-  SharkEntry* entry = (SharkEntry *) nm->instructions_begin();
-  unsigned char* p = entry->code_start();
+  SharkEntry* entry = (SharkEntry *) nm->code_begin();
+  unsigned char* p   = entry->code_start();
   unsigned char* end = entry->code_limit();
 #else
-  unsigned char* p = nm->instructions_begin();
-  unsigned char* end = nm->instructions_end();
+  unsigned char* p   = nm->code_begin();
+  unsigned char* end = nm->code_end();
 #endif // SHARK
 
   // If there has been profiling, print the buckets.
--- a/hotspot/src/share/vm/interpreter/interpreter.hpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreter.hpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@
 
 
     // commit Codelet
-    AbstractInterpreter::code()->commit((*_masm)->code()->pure_code_size());
+    AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size());
     // make sure nobody can use _masm outside a CodeletMark lifespan
     *_masm = NULL;
   }
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1124,7 +1124,7 @@
   if (handler_blob == NULL) {
     return NULL;
   }
-  address handler = handler_blob->instructions_begin();
+  address handler = handler_blob->code_begin();
   _handler_blob = handler_blob;
   _handler = handler;
   return handler;
@@ -1140,7 +1140,7 @@
 
   BufferBlob* bb = BufferBlob::create("Signature Handler Temp Buffer",
                                       SignatureHandlerLibrary::buffer_size);
-  _buffer = bb->instructions_begin();
+  _buffer = bb->code_begin();
 
   _fingerprints = new(ResourceObj::C_HEAP)GrowableArray<uint64_t>(32, true);
   _handlers     = new(ResourceObj::C_HEAP)GrowableArray<address>(32, true);
@@ -1148,16 +1148,16 @@
 
 address SignatureHandlerLibrary::set_handler(CodeBuffer* buffer) {
   address handler   = _handler;
-  int     code_size = buffer->pure_code_size();
-  if (handler + code_size > _handler_blob->instructions_end()) {
+  int     insts_size = buffer->pure_insts_size();
+  if (handler + insts_size > _handler_blob->code_end()) {
     // get a new handler blob
     handler = set_handler_blob();
   }
   if (handler != NULL) {
-    memcpy(handler, buffer->code_begin(), code_size);
+    memcpy(handler, buffer->insts_begin(), insts_size);
     pd_set_handler(handler);
-    ICache::invalidate_range(handler, code_size);
-    _handler = handler + code_size;
+    ICache::invalidate_range(handler, insts_size);
+    _handler = handler + insts_size;
   }
   return handler;
 }
@@ -1196,8 +1196,8 @@
                           (method->is_static() ? "static" : "receiver"),
                           method->name_and_sig_as_C_string(),
                           fingerprint,
-                          buffer.code_size());
-            Disassembler::decode(handler, handler + buffer.code_size());
+                          buffer.insts_size());
+            Disassembler::decode(handler, handler + buffer.insts_size());
 #ifndef PRODUCT
             tty->print_cr(" --- associated result handler ---");
             address rh_begin = Interpreter::result_handler(method()->result_type());
--- a/hotspot/src/share/vm/opto/compile.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -400,7 +400,7 @@
   }
 
   // Initialize the relocation buffers
-  relocInfo* locs_buf = (relocInfo*) blob->instructions_end() - MAX_locs_size;
+  relocInfo* locs_buf = (relocInfo*) blob->content_end() - MAX_locs_size;
   set_scratch_locs_memory(locs_buf);
 }
 
@@ -422,9 +422,9 @@
   assert(blob != NULL, "Initialize BufferBlob at start");
   assert(blob->size() > MAX_inst_size, "sanity");
   relocInfo* locs_buf = scratch_locs_memory();
-  address blob_begin = blob->instructions_begin();
+  address blob_begin = blob->content_begin();
   address blob_end   = (address)locs_buf;
-  assert(blob->instructions_contains(blob_end), "sanity");
+  assert(blob->content_contains(blob_end), "sanity");
   CodeBuffer buf(blob_begin, blob_end - blob_begin);
   buf.initialize_consts_size(MAX_const_size);
   buf.initialize_stubs_size(MAX_stubs_size);
@@ -433,7 +433,7 @@
   buf.insts()->initialize_shared_locs(&locs_buf[0],     lsize);
   buf.stubs()->initialize_shared_locs(&locs_buf[lsize], lsize);
   n->emit(buf, this->regalloc());
-  return buf.code_size();
+  return buf.insts_size();
 }
 
 
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1891,7 +1891,7 @@
   kill_dead_locals();
 
   // Now insert the uncommon trap subroutine call
-  address call_addr = SharedRuntime::uncommon_trap_blob()->instructions_begin();
+  address call_addr = SharedRuntime::uncommon_trap_blob()->entry_point();
   const TypePtr* no_memory_effects = NULL;
   // Pass the index of the class to be loaded
   Node* call = make_runtime_call(RC_NO_LEAF | RC_UNCOMMON |
--- a/hotspot/src/share/vm/opto/lcm.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/opto/lcm.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,8 +72,7 @@
     for (uint i1 = 0; i1 < null_block->_nodes.size(); i1++) {
       Node* nn = null_block->_nodes[i1];
       if (nn->is_MachCall() &&
-          nn->as_MachCall()->entry_point() ==
-          SharedRuntime::uncommon_trap_blob()->instructions_begin()) {
+          nn->as_MachCall()->entry_point() == SharedRuntime::uncommon_trap_blob()->entry_point()) {
         const Type* trtype = nn->in(TypeFunc::Parms)->bottom_type();
         if (trtype->isa_int() && trtype->is_int()->is_con()) {
           jint tr_con = trtype->is_int()->get_con();
--- a/hotspot/src/share/vm/opto/library_call.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -4962,8 +4962,7 @@
       for (DUIterator_Fast jmax, j = not_ctl->fast_outs(jmax); j < jmax; j++) {
         Node* obs = not_ctl->fast_out(j);
         if (obs->in(0) == not_ctl && obs->is_Call() &&
-            (obs->as_Call()->entry_point() ==
-             SharedRuntime::uncommon_trap_blob()->instructions_begin())) {
+            (obs->as_Call()->entry_point() == SharedRuntime::uncommon_trap_blob()->entry_point())) {
           found_trap = true; break;
         }
       }
--- a/hotspot/src/share/vm/opto/output.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/opto/output.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1184,7 +1184,7 @@
       MacroAssembler(cb).bind( blk_labels[b->_pre_order] );
 
     else
-      assert( blk_labels[b->_pre_order].loc_pos() == cb->code_size(),
+      assert( blk_labels[b->_pre_order].loc_pos() == cb->insts_size(),
               "label position does not match code offset" );
 
     uint last_inst = b->_nodes.size();
@@ -1225,7 +1225,7 @@
         // If this requires all previous instructions be flushed, then do so
         if( is_sfn || is_mcall || mach->alignment_required() != 1) {
           cb->flush_bundle(true);
-          current_offset = cb->code_size();
+          current_offset = cb->insts_size();
         }
 
         // align the instruction if necessary
@@ -1246,7 +1246,7 @@
           _cfg->_bbs.map( nop->_idx, b );
           nop->emit(*cb, _regalloc);
           cb->flush_bundle(true);
-          current_offset = cb->code_size();
+          current_offset = cb->insts_size();
         }
 
         // Remember the start of the last call in a basic block
@@ -1348,12 +1348,12 @@
       // Save the offset for the listing
 #ifndef PRODUCT
       if( node_offsets && n->_idx < node_offset_limit )
-        node_offsets[n->_idx] = cb->code_size();
+        node_offsets[n->_idx] = cb->insts_size();
 #endif
 
       // "Normal" instruction case
       n->emit(*cb, _regalloc);
-      current_offset  = cb->code_size();
+      current_offset  = cb->insts_size();
       non_safepoints.observe_instruction(n, current_offset);
 
       // mcall is last "call" that can be a safepoint
@@ -1372,13 +1372,12 @@
         assert(delay_slot != NULL, "expecting delay slot node");
 
         // Back up 1 instruction
-        cb->set_code_end(
-          cb->code_end()-Pipeline::instr_unit_size());
+        cb->set_insts_end(cb->insts_end() - Pipeline::instr_unit_size());
 
         // Save the offset for the listing
 #ifndef PRODUCT
         if( node_offsets && delay_slot->_idx < node_offset_limit )
-          node_offsets[delay_slot->_idx] = cb->code_size();
+          node_offsets[delay_slot->_idx] = cb->insts_size();
 #endif
 
         // Support a SafePoint in the delay slot
@@ -1420,7 +1419,7 @@
         b->_nodes.insert( b->_nodes.size(), nop );
         _cfg->_bbs.map( nop->_idx, b );
         nop->emit(*cb, _regalloc);
-        current_offset = cb->code_size();
+        current_offset = cb->insts_size();
       }
     }
 
@@ -1437,13 +1436,13 @@
   // Compute the size of the first block
   _first_block_size = blk_labels[1].loc_pos() - blk_labels[0].loc_pos();
 
-  assert(cb->code_size() < 500000, "method is unreasonably large");
+  assert(cb->insts_size() < 500000, "method is unreasonably large");
 
   // ------------------
 
 #ifndef PRODUCT
   // Information on the size of the method, without the extraneous code
-  Scheduling::increment_method_size(cb->code_size());
+  Scheduling::increment_method_size(cb->insts_size());
 #endif
 
   // ------------------
--- a/hotspot/src/share/vm/opto/stringopts.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/opto/stringopts.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -157,7 +157,7 @@
       Node* uct = _uncommon_traps.at(u);
 
       // Build a new call using the jvms state of the allocate
-      address call_addr = SharedRuntime::uncommon_trap_blob()->instructions_begin();
+      address call_addr = SharedRuntime::uncommon_trap_blob()->entry_point();
       const TypeFunc* call_type = OptoRuntime::uncommon_trap_Type();
       int size = call_type->domain()->cnt();
       const TypePtr* no_memory_effects = NULL;
--- a/hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -114,7 +114,7 @@
   // check if this starting address has been seen already - the
   // assumption is that stubs are inserted into the list before the
   // enclosing BufferBlobs.
-  address addr = cb->instructions_begin();
+  address addr = cb->code_begin();
   for (int i=0; i<_global_code_blobs->length(); i++) {
     JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i);
     if (addr == scb->code_begin()) {
@@ -123,8 +123,7 @@
   }
 
   // record the CodeBlob details as a JvmtiCodeBlobDesc
-  JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->instructions_begin(),
-                                                 cb->instructions_end());
+  JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end());
   _global_code_blobs->append(scb);
 }
 
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -687,8 +687,8 @@
  public:
   JvmtiCompiledMethodLoadEventMark(JavaThread *thread, nmethod *nm, void* compile_info_ptr = NULL)
           : JvmtiMethodEventMark(thread,methodHandle(thread, nm->method())) {
-    _code_data = nm->code_begin();
-    _code_size = nm->code_size();
+    _code_data = nm->insts_begin();
+    _code_size = nm->insts_size();
     _compile_info = compile_info_ptr; // Set void pointer of compiledMethodLoad Event. Default value is NULL.
     JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
   }
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -113,8 +113,7 @@
   _adapter_code = MethodHandlesAdapterBlob::create(_adapter_code_size);
   if (_adapter_code == NULL)
     vm_exit_out_of_memory(_adapter_code_size, "CodeCache: no room for MethodHandles adapters");
-  CodeBuffer code(_adapter_code->instructions_begin(), _adapter_code->instructions_size());
-
+  CodeBuffer code(_adapter_code);
   MethodHandlesAdapterGenerator g(&code);
   g.generate();
 }
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -439,7 +439,7 @@
   if (!instanceKlass::cast(m->method_holder())->is_initialized()) return (_msg = "method holder not initialized");
   if (m->is_native()) return (_msg = "native method");
   nmethod* m_code = m->code();
-  if( m_code != NULL && m_code->instructions_size() > InlineSmallCode )
+  if (m_code != NULL && m_code->code_size() > InlineSmallCode)
     return (_msg = "already compiled into a big method");
 
   // use frequency-based objections only for non-trivial methods
--- a/hotspot/src/share/vm/runtime/frame.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -537,8 +537,8 @@
     st->cr();
 #ifndef PRODUCT
     if (end == NULL) {
-      begin = _cb->instructions_begin();
-      end = _cb->instructions_end();
+      begin = _cb->code_begin();
+      end   = _cb->code_end();
     }
 #endif
   }
--- a/hotspot/src/share/vm/runtime/icache.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/icache.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
   ResourceMark rm;
 
   BufferBlob* b = BufferBlob::create("flush_icache_stub", ICache::stub_size);
-  CodeBuffer c(b->instructions_begin(), b->instructions_size());
+  CodeBuffer c(b);
 
   ICacheStubGenerator g(&c);
   g.generate_icache_flush(&_flush_icache_stub);
--- a/hotspot/src/share/vm/runtime/rframe.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/rframe.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@
 int CompiledRFrame::cost() const {
   nmethod* nm = top_method()->code();
   if (nm != NULL) {
-    return nm->code_size();
+    return nm->insts_size();
   } else {
     return top_method()->code_size();
   }
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -455,11 +455,11 @@
   if (at_poll_return) {
     assert(SharedRuntime::polling_page_return_handler_blob() != NULL,
            "polling page return stub not created yet");
-    stub = SharedRuntime::polling_page_return_handler_blob()->instructions_begin();
+    stub = SharedRuntime::polling_page_return_handler_blob()->entry_point();
   } else {
     assert(SharedRuntime::polling_page_safepoint_handler_blob() != NULL,
            "polling page safepoint stub not created yet");
-    stub = SharedRuntime::polling_page_safepoint_handler_blob()->instructions_begin();
+    stub = SharedRuntime::polling_page_safepoint_handler_blob()->entry_point();
   }
 #ifndef PRODUCT
   if( TraceSafepoint ) {
@@ -574,7 +574,7 @@
   }
 
   // found handling method => lookup exception handler
-  int catch_pco = ret_pc - nm->instructions_begin();
+  int catch_pco = ret_pc - nm->code_begin();
 
   ExceptionHandlerTable table(nm);
   HandlerTableEntry *t = table.entry_for(catch_pco, handler_bci, scope_depth);
@@ -607,7 +607,7 @@
     return NULL;
   }
 
-  return nm->instructions_begin() + t->pco();
+  return nm->code_begin() + t->pco();
 }
 
 JRT_ENTRY(void, SharedRuntime::throw_AbstractMethodError(JavaThread* thread))
@@ -2252,7 +2252,7 @@
 
   ResourceMark rm;
 
-  NOT_PRODUCT(int code_size);
+  NOT_PRODUCT(int insts_size);
   AdapterBlob* B = NULL;
   AdapterHandlerEntry* entry = NULL;
   AdapterFingerPrint* fingerprint = NULL;
@@ -2305,7 +2305,7 @@
 
     BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
     if (buf != NULL) {
-      CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+      CodeBuffer buffer(buf);
       short buffer_locs[20];
       buffer.insts()->initialize_shared_locs((relocInfo*)buffer_locs,
                                              sizeof(buffer_locs)/sizeof(relocInfo));
@@ -2321,19 +2321,19 @@
 #ifdef ASSERT
       if (VerifyAdapterSharing) {
         if (shared_entry != NULL) {
-          assert(shared_entry->compare_code(buf->instructions_begin(), buffer.code_size(), total_args_passed, sig_bt),
+          assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt),
                  "code must match");
           // Release the one just created and return the original
           _adapters->free_entry(entry);
           return shared_entry;
         } else  {
-          entry->save_code(buf->instructions_begin(), buffer.code_size(), total_args_passed, sig_bt);
+          entry->save_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt);
         }
       }
 #endif
 
       B = AdapterBlob::create(&buffer);
-      NOT_PRODUCT(code_size = buffer.code_size());
+      NOT_PRODUCT(insts_size = buffer.insts_size());
     }
     if (B == NULL) {
       // CodeCache is full, disable compilation
@@ -2343,16 +2343,16 @@
       CompileBroker::handle_full_code_cache();
       return NULL; // Out of CodeCache space
     }
-    entry->relocate(B->instructions_begin());
+    entry->relocate(B->content_begin());
 #ifndef PRODUCT
     // debugging suppport
     if (PrintAdapterHandlers) {
       tty->cr();
       tty->print_cr("i2c argument handler #%d for: %s %s (fingerprint = %s, %d bytes generated)",
                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
-                    method->signature()->as_C_string(), fingerprint->as_string(), code_size );
+                    method->signature()->as_C_string(), fingerprint->as_string(), insts_size );
       tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
-      Disassembler::decode(entry->get_i2c_entry(), entry->get_i2c_entry() + code_size);
+      Disassembler::decode(entry->get_i2c_entry(), entry->get_i2c_entry() + insts_size);
     }
 #endif
 
@@ -2366,13 +2366,11 @@
                  "%s(%s)@" PTR_FORMAT,
                  B->name(),
                  fingerprint->as_string(),
-                 B->instructions_begin());
-    Forte::register_stub(blob_id, B->instructions_begin(), B->instructions_end());
+                 B->content_begin());
+    Forte::register_stub(blob_id, B->content_begin(), B->content_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
-      JvmtiExport::post_dynamic_code_generated(blob_id,
-                                               B->instructions_begin(),
-                                               B->instructions_end());
+      JvmtiExport::post_dynamic_code_generated(blob_id, B->content_begin(), B->content_end());
     }
   }
   return entry;
@@ -2456,7 +2454,7 @@
 
     BufferBlob*  buf = buffer_blob(); // the temporary code buffer in CodeCache
     if (buf != NULL) {
-      CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+      CodeBuffer buffer(buf);
       double locs_buf[20];
       buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
       MacroAssembler _masm(&buffer);
@@ -2540,7 +2538,7 @@
 
     BufferBlob*  buf = buffer_blob(); // the temporary code buffer in CodeCache
     if (buf != NULL) {
-      CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+      CodeBuffer buffer(buf);
       // Need a few relocation entries
       double locs_buf[20];
       buffer.insts()->initialize_shared_locs(
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Wed Aug 25 05:27:54 2010 -0700
@@ -173,12 +173,12 @@
 
   static address get_ic_miss_stub() {
     assert(_ic_miss_blob!= NULL, "oops");
-    return _ic_miss_blob->instructions_begin();
+    return _ic_miss_blob->entry_point();
   }
 
   static address get_handle_wrong_method_stub() {
     assert(_wrong_method_blob!= NULL, "oops");
-    return _wrong_method_blob->instructions_begin();
+    return _wrong_method_blob->entry_point();
   }
 
 #ifdef COMPILER2
@@ -188,15 +188,15 @@
 
   static address get_resolve_opt_virtual_call_stub(){
     assert(_resolve_opt_virtual_call_blob != NULL, "oops");
-    return _resolve_opt_virtual_call_blob->instructions_begin();
+    return _resolve_opt_virtual_call_blob->entry_point();
   }
   static address get_resolve_virtual_call_stub() {
     assert(_resolve_virtual_call_blob != NULL, "oops");
-    return _resolve_virtual_call_blob->instructions_begin();
+    return _resolve_virtual_call_blob->entry_point();
   }
   static address get_resolve_static_call_stub() {
     assert(_resolve_static_call_blob != NULL, "oops");
-    return _resolve_static_call_blob->instructions_begin();
+    return _resolve_static_call_blob->entry_point();
   }
 
   static SafepointBlob* polling_page_return_handler_blob()     { return _polling_page_return_handler_blob; }
@@ -548,16 +548,17 @@
 // This library manages argument marshaling adapters and native wrappers.
 // There are 2 flavors of adapters: I2C and C2I.
 //
-// The I2C flavor takes a stock interpreted call setup, marshals the arguments
-// for a Java-compiled call, and jumps to Rmethod-> code()->
-// instructions_begin().  It is broken to call it without an nmethod assigned.
-// The usual behavior is to lift any register arguments up out of the stack
-// and possibly re-pack the extra arguments to be contigious.  I2C adapters
-// will save what the interpreter's stack pointer will be after arguments are
-// popped, then adjust the interpreter's frame size to force alignment and
-// possibly to repack the arguments.  After re-packing, it jumps to the
-// compiled code start.  There are no safepoints in this adapter code and a GC
-// cannot happen while marshaling is in progress.
+// The I2C flavor takes a stock interpreted call setup, marshals the
+// arguments for a Java-compiled call, and jumps to Rmethod-> code()->
+// code_begin().  It is broken to call it without an nmethod assigned.
+// The usual behavior is to lift any register arguments up out of the
+// stack and possibly re-pack the extra arguments to be contigious.
+// I2C adapters will save what the interpreter's stack pointer will be
+// after arguments are popped, then adjust the interpreter's frame
+// size to force alignment and possibly to repack the arguments.
+// After re-packing, it jumps to the compiled code start.  There are
+// no safepoints in this adapter code and a GC cannot happen while
+// marshaling is in progress.
 //
 // The C2I flavor takes a stock compiled call setup plus the target method in
 // Rmethod, marshals the arguments for an interpreted call and jumps to
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -119,10 +119,9 @@
     TraceTime timer("StubRoutines generation 1", TraceStartupTime);
     _code1 = BufferBlob::create("StubRoutines (1)", code_size1);
     if (_code1 == NULL) {
-      vm_exit_out_of_memory(code_size1,
-                            "CodeCache: no room for StubRoutines (1)");
+      vm_exit_out_of_memory(code_size1, "CodeCache: no room for StubRoutines (1)");
     }
-    CodeBuffer buffer(_code1->instructions_begin(), _code1->instructions_size());
+    CodeBuffer buffer(_code1);
     StubGenerator_generate(&buffer, false);
   }
 }
@@ -172,10 +171,9 @@
     TraceTime timer("StubRoutines generation 2", TraceStartupTime);
     _code2 = BufferBlob::create("StubRoutines (2)", code_size2);
     if (_code2 == NULL) {
-      vm_exit_out_of_memory(code_size2,
-                            "CodeCache: no room for StubRoutines (2)");
+      vm_exit_out_of_memory(code_size2, "CodeCache: no room for StubRoutines (2)");
     }
-    CodeBuffer buffer(_code2->instructions_begin(), _code2->instructions_size());
+    CodeBuffer buffer(_code2);
     StubGenerator_generate(&buffer, true);
   }
 
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Mon Aug 23 09:09:36 2010 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Aug 25 05:27:54 2010 -0700
@@ -604,7 +604,8 @@
   nonstatic_field(CodeBlob,                    _size,                                         int)                                   \
   nonstatic_field(CodeBlob,                    _header_size,                                  int)                                   \
   nonstatic_field(CodeBlob,                    _relocation_size,                              int)                                   \
-  nonstatic_field(CodeBlob,                    _instructions_offset,                          int)                                   \
+  nonstatic_field(CodeBlob,                    _content_offset,                               int)                                   \
+  nonstatic_field(CodeBlob,                    _code_offset,                                  int)                                   \
   nonstatic_field(CodeBlob,                    _frame_complete_offset,                        int)                                   \
   nonstatic_field(CodeBlob,                    _data_offset,                                  int)                                   \
   nonstatic_field(CodeBlob,                    _frame_size,                                   int)                                   \