Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/interp_masm_x86_64.cpp @ 1513:df736661d0c8
Merge
author | jrose |
---|---|
date | Tue, 11 May 2010 15:19:19 -0700 |
parents | 2338d41fbd81 |
children | c18cbe5936b8 ab102d5d923e |
comparison
equal
deleted
inserted
replaced
1496:e8e83be27dd7 | 1513:df736661d0c8 |
---|---|
262 | 262 |
263 | 263 |
264 | 264 |
265 // Java Expression Stack | 265 // Java Expression Stack |
266 | 266 |
267 #ifdef ASSERT | |
268 // Verifies that the stack tag matches. Must be called before the stack | |
269 // value is popped off the stack. | |
270 void InterpreterMacroAssembler::verify_stack_tag(frame::Tag t) { | |
271 if (TaggedStackInterpreter) { | |
272 frame::Tag tag = t; | |
273 if (t == frame::TagCategory2) { | |
274 tag = frame::TagValue; | |
275 Label hokay; | |
276 cmpptr(Address(rsp, 3*wordSize), (int32_t)tag); | |
277 jcc(Assembler::equal, hokay); | |
278 stop("Java Expression stack tag high value is bad"); | |
279 bind(hokay); | |
280 } | |
281 Label okay; | |
282 cmpptr(Address(rsp, wordSize), (int32_t)tag); | |
283 jcc(Assembler::equal, okay); | |
284 // Also compare if the stack value is zero, then the tag might | |
285 // not have been set coming from deopt. | |
286 cmpptr(Address(rsp, 0), 0); | |
287 jcc(Assembler::equal, okay); | |
288 stop("Java Expression stack tag value is bad"); | |
289 bind(okay); | |
290 } | |
291 } | |
292 #endif // ASSERT | |
293 | |
294 void InterpreterMacroAssembler::pop_ptr(Register r) { | 267 void InterpreterMacroAssembler::pop_ptr(Register r) { |
295 debug_only(verify_stack_tag(frame::TagReference)); | |
296 pop(r); | 268 pop(r); |
297 if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); | |
298 } | |
299 | |
300 void InterpreterMacroAssembler::pop_ptr(Register r, Register tag) { | |
301 pop(r); | |
302 if (TaggedStackInterpreter) pop(tag); | |
303 } | 269 } |
304 | 270 |
305 void InterpreterMacroAssembler::pop_i(Register r) { | 271 void InterpreterMacroAssembler::pop_i(Register r) { |
306 // XXX can't use pop currently, upper half non clean | 272 // XXX can't use pop currently, upper half non clean |
307 debug_only(verify_stack_tag(frame::TagValue)); | |
308 movl(r, Address(rsp, 0)); | 273 movl(r, Address(rsp, 0)); |
309 addptr(rsp, wordSize); | 274 addptr(rsp, wordSize); |
310 if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); | |
311 } | 275 } |
312 | 276 |
313 void InterpreterMacroAssembler::pop_l(Register r) { | 277 void InterpreterMacroAssembler::pop_l(Register r) { |
314 debug_only(verify_stack_tag(frame::TagCategory2)); | |
315 movq(r, Address(rsp, 0)); | 278 movq(r, Address(rsp, 0)); |
316 addptr(rsp, 2 * Interpreter::stackElementSize()); | 279 addptr(rsp, 2 * Interpreter::stackElementSize); |
317 } | 280 } |
318 | 281 |
319 void InterpreterMacroAssembler::pop_f(XMMRegister r) { | 282 void InterpreterMacroAssembler::pop_f(XMMRegister r) { |
320 debug_only(verify_stack_tag(frame::TagValue)); | |
321 movflt(r, Address(rsp, 0)); | 283 movflt(r, Address(rsp, 0)); |
322 addptr(rsp, wordSize); | 284 addptr(rsp, wordSize); |
323 if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); | |
324 } | 285 } |
325 | 286 |
326 void InterpreterMacroAssembler::pop_d(XMMRegister r) { | 287 void InterpreterMacroAssembler::pop_d(XMMRegister r) { |
327 debug_only(verify_stack_tag(frame::TagCategory2)); | |
328 movdbl(r, Address(rsp, 0)); | 288 movdbl(r, Address(rsp, 0)); |
329 addptr(rsp, 2 * Interpreter::stackElementSize()); | 289 addptr(rsp, 2 * Interpreter::stackElementSize); |
330 } | 290 } |
331 | 291 |
332 void InterpreterMacroAssembler::push_ptr(Register r) { | 292 void InterpreterMacroAssembler::push_ptr(Register r) { |
333 if (TaggedStackInterpreter) push(frame::TagReference); | |
334 push(r); | 293 push(r); |
335 } | 294 } |
336 | 295 |
337 void InterpreterMacroAssembler::push_ptr(Register r, Register tag) { | 296 void InterpreterMacroAssembler::push_i(Register r) { |
338 if (TaggedStackInterpreter) push(tag); | |
339 push(r); | 297 push(r); |
340 } | 298 } |
341 | 299 |
342 void InterpreterMacroAssembler::push_i(Register r) { | |
343 if (TaggedStackInterpreter) push(frame::TagValue); | |
344 push(r); | |
345 } | |
346 | |
347 void InterpreterMacroAssembler::push_l(Register r) { | 300 void InterpreterMacroAssembler::push_l(Register r) { |
348 if (TaggedStackInterpreter) { | 301 subptr(rsp, 2 * wordSize); |
349 push(frame::TagValue); | |
350 subptr(rsp, 1 * wordSize); | |
351 push(frame::TagValue); | |
352 subptr(rsp, 1 * wordSize); | |
353 } else { | |
354 subptr(rsp, 2 * wordSize); | |
355 } | |
356 movq(Address(rsp, 0), r); | 302 movq(Address(rsp, 0), r); |
357 } | 303 } |
358 | 304 |
359 void InterpreterMacroAssembler::push_f(XMMRegister r) { | 305 void InterpreterMacroAssembler::push_f(XMMRegister r) { |
360 if (TaggedStackInterpreter) push(frame::TagValue); | |
361 subptr(rsp, wordSize); | 306 subptr(rsp, wordSize); |
362 movflt(Address(rsp, 0), r); | 307 movflt(Address(rsp, 0), r); |
363 } | 308 } |
364 | 309 |
365 void InterpreterMacroAssembler::push_d(XMMRegister r) { | 310 void InterpreterMacroAssembler::push_d(XMMRegister r) { |
366 if (TaggedStackInterpreter) { | 311 subptr(rsp, 2 * wordSize); |
367 push(frame::TagValue); | |
368 subptr(rsp, 1 * wordSize); | |
369 push(frame::TagValue); | |
370 subptr(rsp, 1 * wordSize); | |
371 } else { | |
372 subptr(rsp, 2 * wordSize); | |
373 } | |
374 movdbl(Address(rsp, 0), r); | 312 movdbl(Address(rsp, 0), r); |
375 } | 313 } |
376 | 314 |
377 void InterpreterMacroAssembler::pop(TosState state) { | 315 void InterpreterMacroAssembler::pop(TosState state) { |
378 switch (state) { | 316 switch (state) { |
405 default : ShouldNotReachHere(); | 343 default : ShouldNotReachHere(); |
406 } | 344 } |
407 } | 345 } |
408 | 346 |
409 | 347 |
410 | 348 // Helpers for swap and dup |
411 | 349 void InterpreterMacroAssembler::load_ptr(int n, Register val) { |
412 // Tagged stack helpers for swap and dup | |
413 void InterpreterMacroAssembler::load_ptr_and_tag(int n, Register val, | |
414 Register tag) { | |
415 movptr(val, Address(rsp, Interpreter::expr_offset_in_bytes(n))); | 350 movptr(val, Address(rsp, Interpreter::expr_offset_in_bytes(n))); |
416 if (TaggedStackInterpreter) { | 351 } |
417 movptr(tag, Address(rsp, Interpreter::expr_tag_offset_in_bytes(n))); | 352 |
418 } | 353 void InterpreterMacroAssembler::store_ptr(int n, Register val) { |
419 } | |
420 | |
421 void InterpreterMacroAssembler::store_ptr_and_tag(int n, Register val, | |
422 Register tag) { | |
423 movptr(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val); | 354 movptr(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val); |
424 if (TaggedStackInterpreter) { | 355 } |
425 movptr(Address(rsp, Interpreter::expr_tag_offset_in_bytes(n)), tag); | |
426 } | |
427 } | |
428 | |
429 | |
430 // Tagged local support | |
431 void InterpreterMacroAssembler::tag_local(frame::Tag tag, int n) { | |
432 if (TaggedStackInterpreter) { | |
433 if (tag == frame::TagCategory2) { | |
434 movptr(Address(r14, Interpreter::local_tag_offset_in_bytes(n+1)), | |
435 (int32_t)frame::TagValue); | |
436 movptr(Address(r14, Interpreter::local_tag_offset_in_bytes(n)), | |
437 (int32_t)frame::TagValue); | |
438 } else { | |
439 movptr(Address(r14, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)tag); | |
440 } | |
441 } | |
442 } | |
443 | |
444 void InterpreterMacroAssembler::tag_local(frame::Tag tag, Register idx) { | |
445 if (TaggedStackInterpreter) { | |
446 if (tag == frame::TagCategory2) { | |
447 movptr(Address(r14, idx, Address::times_8, | |
448 Interpreter::local_tag_offset_in_bytes(1)), (int32_t)frame::TagValue); | |
449 movptr(Address(r14, idx, Address::times_8, | |
450 Interpreter::local_tag_offset_in_bytes(0)), (int32_t)frame::TagValue); | |
451 } else { | |
452 movptr(Address(r14, idx, Address::times_8, Interpreter::local_tag_offset_in_bytes(0)), | |
453 (int32_t)tag); | |
454 } | |
455 } | |
456 } | |
457 | |
458 void InterpreterMacroAssembler::tag_local(Register tag, Register idx) { | |
459 if (TaggedStackInterpreter) { | |
460 // can only be TagValue or TagReference | |
461 movptr(Address(r14, idx, Address::times_8, Interpreter::local_tag_offset_in_bytes(0)), tag); | |
462 } | |
463 } | |
464 | |
465 | |
466 void InterpreterMacroAssembler::tag_local(Register tag, int n) { | |
467 if (TaggedStackInterpreter) { | |
468 // can only be TagValue or TagReference | |
469 movptr(Address(r14, Interpreter::local_tag_offset_in_bytes(n)), tag); | |
470 } | |
471 } | |
472 | |
473 #ifdef ASSERT | |
474 void InterpreterMacroAssembler::verify_local_tag(frame::Tag tag, int n) { | |
475 if (TaggedStackInterpreter) { | |
476 frame::Tag t = tag; | |
477 if (tag == frame::TagCategory2) { | |
478 Label nbl; | |
479 t = frame::TagValue; // change to what is stored in locals | |
480 cmpptr(Address(r14, Interpreter::local_tag_offset_in_bytes(n+1)), (int32_t)t); | |
481 jcc(Assembler::equal, nbl); | |
482 stop("Local tag is bad for long/double"); | |
483 bind(nbl); | |
484 } | |
485 Label notBad; | |
486 cmpq(Address(r14, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)t); | |
487 jcc(Assembler::equal, notBad); | |
488 // Also compare if the local value is zero, then the tag might | |
489 // not have been set coming from deopt. | |
490 cmpptr(Address(r14, Interpreter::local_offset_in_bytes(n)), 0); | |
491 jcc(Assembler::equal, notBad); | |
492 stop("Local tag is bad"); | |
493 bind(notBad); | |
494 } | |
495 } | |
496 | |
497 void InterpreterMacroAssembler::verify_local_tag(frame::Tag tag, Register idx) { | |
498 if (TaggedStackInterpreter) { | |
499 frame::Tag t = tag; | |
500 if (tag == frame::TagCategory2) { | |
501 Label nbl; | |
502 t = frame::TagValue; // change to what is stored in locals | |
503 cmpptr(Address(r14, idx, Address::times_8, Interpreter::local_tag_offset_in_bytes(1)), (int32_t)t); | |
504 jcc(Assembler::equal, nbl); | |
505 stop("Local tag is bad for long/double"); | |
506 bind(nbl); | |
507 } | |
508 Label notBad; | |
509 cmpptr(Address(r14, idx, Address::times_8, Interpreter::local_tag_offset_in_bytes(0)), (int32_t)t); | |
510 jcc(Assembler::equal, notBad); | |
511 // Also compare if the local value is zero, then the tag might | |
512 // not have been set coming from deopt. | |
513 cmpptr(Address(r14, idx, Address::times_8, Interpreter::local_offset_in_bytes(0)), 0); | |
514 jcc(Assembler::equal, notBad); | |
515 stop("Local tag is bad"); | |
516 bind(notBad); | |
517 } | |
518 } | |
519 #endif // ASSERT | |
520 | 356 |
521 | 357 |
522 void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point) { | 358 void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point) { |
523 MacroAssembler::call_VM_leaf_base(entry_point, 0); | 359 MacroAssembler::call_VM_leaf_base(entry_point, 0); |
524 } | 360 } |