2053N/A * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A // input is > 0 -> return maxInt 0N/A // result register already contains 0x80000000, so subtracting 1 gives 0x7fffffff 0N/A // input is NaN -> return 0 0N/A // pass the array index on stack because all registers must be preserved 0N/A// Implementation of NewInstanceStub 0N/A "need new_instance id");
0N/A// Implementation of NewTypeArrayStub 0N/A// Implementation of NewObjectArrayStub 0N/A// Implementation of MonitorAccessStubs 0N/A // lock_reg was destroyed by fast unlocking attempt => recompute it 0N/A // note: non-blocking leaf routine => no call info needed 0N/A// Implementation of patching: 0N/A// - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes) 0N/A// - Replace original code with a call to the stub 0N/A// - call to stub, jump to runtime 0N/A// - in runtime: preserve all registers (rspecially objects, i.e., source and destination object) 0N/A// - in runtime: after initializing class, restore original code, reexecute instruction 0N/A // We're patching a 5-7 byte instruction on intel and we need to 0N/A // make sure that we don't see a piece of the instruction. It 0N/A // appears mostly impossible on Intel to simply invalidate other 0N/A // processors caches and since they may do aggressive prefetch it's 0N/A // very hard to make a guess about what code might be in the icache. 0N/A // Force the instruction to be double word aligned so that it 0N/A // doesn't span a cache line. 0N/A // static field accesses have special semantics while the class 0N/A // initializer is being run so we emit a test which can be used to 0N/A // check that this code is being executed by the initializing 0N/A // produce a copy of the load klass instruction for use by the being initialized case 0N/A // make a copy the code which is going to be patched. 0N/A *
ptr =
0x90;
// make the site look like a nop 2311N/A // Load without verification to keep code size small. We need it because 2311N/A // begin_initialized_entry_offset has to fit in a byte. Also, we know it's not null. 0N/A // access_field patches may execute the patched code before it's 0N/A // copied back into place so we need to jump back into the main 0N/A // code of the nmethod to continue execution. 0N/A // make sure this extra code gets skipped 0N/A // Now emit the patch record telling the runtime how to find the 0N/A // pieces of the patch. We only need 3 bytes but for readability of 0N/A // the disassembly we make the data look like a movl reg, imm32, 0N/A // which requires 5 bytes 0N/A // emit the offsets needed to find the code to patch 0N/A // Add enough nops so deoptimization can overwrite the jmp above with a call 0N/A // and not destroy the world. 0N/A // pass the object on stack because all registers must be preserved 0N/A //---------------slow case: call to native----------------- 0N/A // Figure out where the args should go 0N/A // This should really convert the IntrinsicID to the methodOop and signature 0N/A // but I don't know how to do that. 0N/A // (src, src_pos, dest, destPos, length) 0N/A // next registers will get stored on the stack 0N/A for (
int i = 0; i <
5 ; i++ ) {
342N/A///////////////////////////////////////////////////////////////////////////// 2346N/A // At this point we know that marking is in progress. 2346N/A // If do_load() is true then we have to emit the 2346N/A // load of the previous value; otherwise it has already 2346N/A // been loaded into _pre_val. 342N/A "Must be if we're using this.");
342N/A/////////////////////////////////////////////////////////////////////////////