252 253 return true; 254 } 255 256 // FIXME: not applicable in current system 257 // void patch_pc(Thread* thread, address pc); 258 259 public Frame sender(RegisterMap regMap, CodeBlob cb) { 260 X86RegisterMap map = (X86RegisterMap) regMap; 261 262 if (Assert.ASSERTS_ENABLED) { 263 Assert.that(map != null, "map must be set"); 264 } 265 266 // Default is we done have to follow them. The sender_for_xxx will 267 // update it accordingly 268 map.setIncludeArgumentOops(false); 269 270 if (isEntryFrame()) return senderForEntryFrame(map); 271 if (isInterpretedFrame()) return senderForInterpreterFrame(map); 272 if (isRicochetFrame()) return senderForRicochetFrame(map); 273 274 if(cb == null) { 275 cb = VM.getVM().getCodeCache().findBlob(getPC()); 276 } else { 277 if (Assert.ASSERTS_ENABLED) { 278 Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same"); 279 } 280 } 281 282 if (cb != null) { 283 return senderForCompiledFrame(map, cb); 284 } 285 286 // Must be native-compiled frame, i.e. the marshaling code for native 287 // methods that exists in the core system. 288 return new X86Frame(getSenderSP(), getLink(), getSenderPC()); 289 } 290 291 private Frame senderForRicochetFrame(X86RegisterMap map) { 292 if (DEBUG) { 293 System.out.println("senderForRicochetFrame"); 294 } 295 X86RicochetFrame f = X86RicochetFrame.fromFrame(this); 296 if (map.getUpdateMap()) 297 updateMapWithSavedLink(map, f.senderLinkAddress()); 298 return new X86Frame(f.extendedSenderSP(), f.exactSenderSP(), f.senderLink(), f.senderPC()); 299 } 300 301 private Frame senderForEntryFrame(X86RegisterMap map) { 302 if (DEBUG) { 303 System.out.println("senderForEntryFrame"); 304 } 305 if (Assert.ASSERTS_ENABLED) { 306 Assert.that(map != null, "map must be set"); 307 } 308 // Java frame called from C; skip all C frames and return top C 309 // frame of that chunk as the sender 310 X86JavaCallWrapper jcw = (X86JavaCallWrapper) getEntryFrameCallWrapper(); 311 if (Assert.ASSERTS_ENABLED) { 312 Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero"); 313 Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack"); 314 } 315 X86Frame fr; 316 if (jcw.getLastJavaPC() != null) { 317 fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC()); 318 } else { 319 fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP()); 320 } | 252 253 return true; 254 } 255 256 // FIXME: not applicable in current system 257 // void patch_pc(Thread* thread, address pc); 258 259 public Frame sender(RegisterMap regMap, CodeBlob cb) { 260 X86RegisterMap map = (X86RegisterMap) regMap; 261 262 if (Assert.ASSERTS_ENABLED) { 263 Assert.that(map != null, "map must be set"); 264 } 265 266 // Default is we done have to follow them. The sender_for_xxx will 267 // update it accordingly 268 map.setIncludeArgumentOops(false); 269 270 if (isEntryFrame()) return senderForEntryFrame(map); 271 if (isInterpretedFrame()) return senderForInterpreterFrame(map); 272 273 if(cb == null) { 274 cb = VM.getVM().getCodeCache().findBlob(getPC()); 275 } else { 276 if (Assert.ASSERTS_ENABLED) { 277 Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same"); 278 } 279 } 280 281 if (cb != null) { 282 return senderForCompiledFrame(map, cb); 283 } 284 285 // Must be native-compiled frame, i.e. the marshaling code for native 286 // methods that exists in the core system. 287 return new X86Frame(getSenderSP(), getLink(), getSenderPC()); 288 } 289 290 private Frame senderForEntryFrame(X86RegisterMap map) { 291 if (DEBUG) { 292 System.out.println("senderForEntryFrame"); 293 } 294 if (Assert.ASSERTS_ENABLED) { 295 Assert.that(map != null, "map must be set"); 296 } 297 // Java frame called from C; skip all C frames and return top C 298 // frame of that chunk as the sender 299 X86JavaCallWrapper jcw = (X86JavaCallWrapper) getEntryFrameCallWrapper(); 300 if (Assert.ASSERTS_ENABLED) { 301 Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero"); 302 Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack"); 303 } 304 X86Frame fr; 305 if (jcw.getLastJavaPC() != null) { 306 fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC()); 307 } else { 308 fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP()); 309 } |