1 /* |
1 /* |
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. |
3 * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
403 |
403 |
404 // If the result was an oop then unbox it and store it in |
404 // If the result was an oop then unbox it and store it in |
405 // oop_temp where the garbage collector can see it before |
405 // oop_temp where the garbage collector can see it before |
406 // we release the handle it might be protected by. |
406 // we release the handle it might be protected by. |
407 if (handler->result_type() == &ffi_type_pointer) { |
407 if (handler->result_type() == &ffi_type_pointer) { |
408 if (result[0]) |
408 if (result[0] == 0) { |
409 istate->set_oop_temp(*(oop *) result[0]); |
|
410 else |
|
411 istate->set_oop_temp(NULL); |
409 istate->set_oop_temp(NULL); |
|
410 } else { |
|
411 jobject handle = reinterpret_cast<jobject>(result[0]); |
|
412 istate->set_oop_temp(JNIHandles::resolve(handle)); |
|
413 } |
412 } |
414 } |
413 |
415 |
414 // Reset handle block |
416 // Reset handle block |
415 thread->active_handles()->clear(); |
417 thread->active_handles()->clear(); |
416 |
418 |