001 /* 002 * This file is part of the Jikes RVM project (http://jikesrvm.org). 003 * 004 * This file is licensed to You under the Eclipse Public License (EPL); 005 * You may not use this file except in compliance with the License. You 006 * may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/eclipse-1.0.php 009 * 010 * See the COPYRIGHT.txt file distributed with this work for information 011 * regarding copyright ownership. 012 */ 013 package org.jikesrvm.ia32; 014 015 import org.jikesrvm.VM; 016 import org.jikesrvm.runtime.Magic; 017 import org.vmmagic.pragma.NoInline; 018 import org.vmmagic.pragma.Uninterruptible; 019 import org.vmmagic.unboxed.Address; 020 021 /** 022 * Machine specific helper functions for dynamic linking. 023 */ 024 @Uninterruptible 025 public abstract class DynamicLinkerHelper { 026 027 /** 028 * Reach up two stack frames into a frame that is compiled 029 * with the DynamicBridge register protocol and grap 030 * the receiver object of the invoke (ie the first param). 031 * NOTE: assumes that caller has disabled GC. 032 */ 033 @NoInline 034 public static Object getReceiverObject() { 035 036 Address callingFrame = Magic.getCallerFramePointer(Magic.getFramePointer()); 037 callingFrame = Magic.getCallerFramePointer(callingFrame); 038 Address location = Address.zero(); 039 if (0 < RegisterConstants.NUM_PARAMETER_GPRS) { 040 location = callingFrame.plus(BaselineConstants.STACKFRAME_FIRST_PARAMETER_OFFSET).loadAddress(); 041 042 } else { 043 VM.sysFail("DynamicLinerHelper: assumes at least one param passed in registers"); 044 } 045 return Magic.addressAsObject(location); 046 } 047 }