< prev index next >

src/hotspot/cpu/zero/zeroInterpreter_zero.cpp

Print this page

314 
315 int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
316   // Make sure method is native and not abstract
317   assert(method->is_native() && !method->is_abstract(), "should be");
318 
319   JavaThread *thread = THREAD;
320   ZeroStack *stack = thread->zero_stack();
321 
322   // Allocate and initialize our frame
323   InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
324   thread->push_zero_frame(frame);
325   interpreterState istate = frame->interpreter_state();
326   intptr_t *locals = istate->locals();
327 
328   // Lock if necessary
329   BasicObjectLock *monitor;
330   monitor = NULL;
331   if (method->is_synchronized()) {
332     monitor = (BasicObjectLock*) istate->stack_base();
333     oop lockee = monitor->obj();
334     markWord disp = lockee->mark().set_unlocked();
335     monitor->lock()->set_displaced_header(disp);
336     bool call_vm = UseHeavyMonitors;
337     bool inc_monitor_count = true;
338     if (call_vm || lockee->cas_set_mark(markWord::from_pointer(monitor), disp) != disp) {
339       // Is it simple recursive case?
340       if (!call_vm && thread->is_lock_owned((address) disp.clear_lock_bits().to_pointer())) {
341         monitor->lock()->set_displaced_header(markWord::from_pointer(NULL));
342       } else {
343         inc_monitor_count = false;
344         CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor));
345         if (HAS_PENDING_EXCEPTION)
346           goto unwind_and_return;
347       }
348     }
349     if (inc_monitor_count) {
350       THREAD->inc_held_monitor_count();
351     }
352   }
353 
354   // Get the signature handler
355   InterpreterRuntime::SignatureHandler *handler; {
356     address handlerAddr = method->signature_handler();
357     if (handlerAddr == NULL) {
358       CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method));
359       if (HAS_PENDING_EXCEPTION)
360         goto unlock_unwind_and_return;
361 
362       handlerAddr = method->signature_handler();
363       assert(handlerAddr != NULL, "eh?");
364     }
365     if (handlerAddr == (address) InterpreterRuntime::slow_signature_handler) {
366       CALL_VM_NOCHECK(handlerAddr =
367         InterpreterRuntime::slow_signature_handler(thread, method, NULL,NULL));
368       if (HAS_PENDING_EXCEPTION)
369         goto unlock_unwind_and_return;
370     }
371     handler = \

462 
463   // If the result was an oop then unbox it and store it in
464   // oop_temp where the garbage collector can see it before
465   // we release the handle it might be protected by.
466   if (handler->result_type() == &ffi_type_pointer) {
467     if (result[0] == 0) {
468       istate->set_oop_temp(NULL);
469     } else {
470       jobject handle = reinterpret_cast<jobject>(result[0]);
471       istate->set_oop_temp(JNIHandles::resolve(handle));
472     }
473   }
474 
475   // Reset handle block
476   thread->active_handles()->clear();
477 
478  unlock_unwind_and_return:
479 
480   // Unlock if necessary
481   if (monitor) {
482     BasicLock *lock = monitor->lock();
483     markWord header = lock->displaced_header();
484     oop rcvr = monitor->obj();
485     monitor->set_obj(NULL);
486 
487     bool dec_monitor_count = true;
488     if (header.to_pointer() != NULL) {
489       markWord old_header = markWord::encode(lock);
490       if (rcvr->cas_set_mark(header, old_header) != old_header) {
491         monitor->set_obj(rcvr);
492         dec_monitor_count = false;
493         InterpreterRuntime::monitorexit(monitor);
494       }
495     }
496     if (dec_monitor_count) {
497       THREAD->dec_held_monitor_count();
498     }
499   }
500 
501  unwind_and_return:
502 
503   // Unwind the current activation
504   thread->pop_zero_frame();
505 
506   // Pop our parameters
507   stack->set_sp(stack->sp() + method->size_of_parameters());
508 
509   // Push our result
510   if (!HAS_PENDING_EXCEPTION) {
511     BasicType type = method->result_type();
512     stack->set_sp(stack->sp() - type2size[type]);
513 
514     switch (type) {
515     case T_VOID:
516       break;
517 
518     case T_BOOLEAN:

314 
315 int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
316   // Make sure method is native and not abstract
317   assert(method->is_native() && !method->is_abstract(), "should be");
318 
319   JavaThread *thread = THREAD;
320   ZeroStack *stack = thread->zero_stack();
321 
322   // Allocate and initialize our frame
323   InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
324   thread->push_zero_frame(frame);
325   interpreterState istate = frame->interpreter_state();
326   intptr_t *locals = istate->locals();
327 
328   // Lock if necessary
329   BasicObjectLock *monitor;
330   monitor = NULL;
331   if (method->is_synchronized()) {
332     monitor = (BasicObjectLock*) istate->stack_base();
333     oop lockee = monitor->obj();
334 
335     CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, lockee));
336     if (HAS_PENDING_EXCEPTION)
337       goto unwind_and_return;














338   }
339 
340   // Get the signature handler
341   InterpreterRuntime::SignatureHandler *handler; {
342     address handlerAddr = method->signature_handler();
343     if (handlerAddr == NULL) {
344       CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method));
345       if (HAS_PENDING_EXCEPTION)
346         goto unlock_unwind_and_return;
347 
348       handlerAddr = method->signature_handler();
349       assert(handlerAddr != NULL, "eh?");
350     }
351     if (handlerAddr == (address) InterpreterRuntime::slow_signature_handler) {
352       CALL_VM_NOCHECK(handlerAddr =
353         InterpreterRuntime::slow_signature_handler(thread, method, NULL,NULL));
354       if (HAS_PENDING_EXCEPTION)
355         goto unlock_unwind_and_return;
356     }
357     handler = \

448 
449   // If the result was an oop then unbox it and store it in
450   // oop_temp where the garbage collector can see it before
451   // we release the handle it might be protected by.
452   if (handler->result_type() == &ffi_type_pointer) {
453     if (result[0] == 0) {
454       istate->set_oop_temp(NULL);
455     } else {
456       jobject handle = reinterpret_cast<jobject>(result[0]);
457       istate->set_oop_temp(JNIHandles::resolve(handle));
458     }
459   }
460 
461   // Reset handle block
462   thread->active_handles()->clear();
463 
464  unlock_unwind_and_return:
465 
466   // Unlock if necessary
467   if (monitor) {


468     oop rcvr = monitor->obj();
469     monitor->set_obj(NULL);
470     InterpreterRuntime::monitorexit(rcvr);












471   }
472 
473  unwind_and_return:
474 
475   // Unwind the current activation
476   thread->pop_zero_frame();
477 
478   // Pop our parameters
479   stack->set_sp(stack->sp() + method->size_of_parameters());
480 
481   // Push our result
482   if (!HAS_PENDING_EXCEPTION) {
483     BasicType type = method->result_type();
484     stack->set_sp(stack->sp() - type2size[type]);
485 
486     switch (type) {
487     case T_VOID:
488       break;
489 
490     case T_BOOLEAN:
< prev index next >