changeset 13232:f1f33d1ff3e2

made instrumentation of OptimizedCallTarget.call() safe with respect to patching its verified entry point (GRAAL-605)
author Doug Simon <doug.simon@oracle.com>
date Tue, 03 Dec 2013 16:53:21 +0100
parents dad021298158
children 8ea51438445c
files graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java	Tue Dec 03 16:49:12 2013 +0100
+++ b/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java	Tue Dec 03 16:53:21 2013 +0100
@@ -51,11 +51,14 @@
                 Register thisRegister = codeCache.getRegisterConfig().getCallingConventionRegisters(Type.JavaCall, Kind.Object)[0];
                 Register spillRegister = AMD64.r10; // TODO(mg): fix me
                 AMD64Address nMethodAddress = new AMD64Address(thisRegister, getFieldOffset("installedCode", OptimizedCallTarget.class));
+                int verifiedEntryPoint = asm.codeBuffer.position();
                 if (config.useCompressedOops) {
                     asm.movl(spillRegister, nMethodAddress);
+                    asm.nop(AMD64HotSpotBackend.PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE - (asm.codeBuffer.position() - verifiedEntryPoint));
                     AMD64HotSpotMove.decodePointer(asm, spillRegister, registers.getHeapBaseRegister(), config.narrowOopBase, config.narrowOopShift, config.logMinObjAlignment());
                 } else {
                     asm.movq(spillRegister, nMethodAddress);
+                    asm.nop(AMD64HotSpotBackend.PATCHED_VERIFIED_ENTRY_POINT_INSTRUCTION_SIZE - (asm.codeBuffer.position() - verifiedEntryPoint));
                 }
                 Label doProlog = new Label();