Mercurial > hg > graal-jvmci-8
annotate src/cpu/ppc/vm/sharedRuntime_ppc.cpp @ 23660:b5f3a471e646
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 01 Jun 2016 00:11:44 +0200 |
parents | 48fde4d03767 e9e252c83b2b |
children |
rev | line source |
---|---|
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1 /* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
14694 | 3 * Copyright 2012, 2014 SAP AG. All rights reserved. |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
5 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
6 * This code is free software; you can redistribute it and/or modify it |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
7 * under the terms of the GNU General Public License version 2 only, as |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
8 * published by the Free Software Foundation. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
9 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
10 * This code is distributed in the hope that it will be useful, but WITHOUT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
13 * version 2 for more details (a copy is included in the LICENSE file that |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
14 * accompanied this code). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
15 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License version |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
17 * 2 along with this work; if not, write to the Free Software Foundation, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
19 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
22 * questions. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
23 * |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
24 */ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
25 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
26 #include "precompiled.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
27 #include "asm/macroAssembler.inline.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
28 #include "code/debugInfoRec.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
29 #include "code/icBuffer.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
30 #include "code/vtableStubs.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
31 #include "interpreter/interpreter.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
32 #include "oops/compiledICHolder.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
33 #include "prims/jvmtiRedefineClassesTrace.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
34 #include "runtime/sharedRuntime.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
35 #include "runtime/vframeArray.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
36 #include "vmreg_ppc.inline.hpp" |
17809
a433eb716ce1
8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents:
14694
diff
changeset
|
37 #include "adfiles/ad_ppc_64.hpp" |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
38 #ifdef COMPILER1 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
39 #include "c1/c1_Runtime1.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
40 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
41 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
42 #include "opto/runtime.hpp" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
43 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
44 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
45 #define __ masm-> |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
46 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
47 #ifdef PRODUCT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
48 #define BLOCK_COMMENT(str) // nothing |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
49 #else |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
50 #define BLOCK_COMMENT(str) __ block_comment(str) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
51 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
52 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
53 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
54 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
55 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
56 class RegisterSaver { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
57 // Used for saving volatile registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
58 public: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
59 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
60 // Support different return pc locations. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
61 enum ReturnPCLocation { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
62 return_pc_is_lr, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
63 return_pc_is_r4, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
64 return_pc_is_thread_saved_exception_pc |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
65 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
66 |
14684 | 67 static OopMap* push_frame_reg_args_and_save_live_registers(MacroAssembler* masm, |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
68 int* out_frame_size_in_bytes, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
69 bool generate_oop_map, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
70 int return_pc_adjustment, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
71 ReturnPCLocation return_pc_location); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
72 static void restore_live_registers_and_pop_frame(MacroAssembler* masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
73 int frame_size_in_bytes, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
74 bool restore_ctr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
75 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
76 static void push_frame_and_save_argument_registers(MacroAssembler* masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
77 Register r_temp, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
78 int frame_size, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
79 int total_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
80 const VMRegPair *regs, const VMRegPair *regs2 = NULL); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
81 static void restore_argument_registers_and_pop_frame(MacroAssembler*masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
82 int frame_size, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
83 int total_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
84 const VMRegPair *regs, const VMRegPair *regs2 = NULL); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
85 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
86 // During deoptimization only the result registers need to be restored |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
87 // all the other values have already been extracted. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
88 static void restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
89 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
90 // Constants and data structures: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
91 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
92 typedef enum { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
93 int_reg = 0, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
94 float_reg = 1, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
95 special_reg = 2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
96 } RegisterType; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
97 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
98 typedef enum { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
99 reg_size = 8, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
100 half_reg_size = reg_size / 2, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
101 } RegisterConstants; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
102 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
103 typedef struct { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
104 RegisterType reg_type; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
105 int reg_num; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
106 VMReg vmreg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
107 } LiveRegType; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
108 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
109 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
110 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
111 #define RegisterSaver_LiveSpecialReg(regname) \ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
112 { RegisterSaver::special_reg, regname->encoding(), regname->as_VMReg() } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
113 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
114 #define RegisterSaver_LiveIntReg(regname) \ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
115 { RegisterSaver::int_reg, regname->encoding(), regname->as_VMReg() } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
116 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
117 #define RegisterSaver_LiveFloatReg(regname) \ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
118 { RegisterSaver::float_reg, regname->encoding(), regname->as_VMReg() } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
119 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
120 static const RegisterSaver::LiveRegType RegisterSaver_LiveRegs[] = { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
121 // Live registers which get spilled to the stack. Register |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
122 // positions in this array correspond directly to the stack layout. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
123 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
124 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
125 // live special registers: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
126 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
127 RegisterSaver_LiveSpecialReg(SR_CTR), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
128 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
129 // live float registers: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
130 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
131 RegisterSaver_LiveFloatReg( F0 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
132 RegisterSaver_LiveFloatReg( F1 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
133 RegisterSaver_LiveFloatReg( F2 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
134 RegisterSaver_LiveFloatReg( F3 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
135 RegisterSaver_LiveFloatReg( F4 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
136 RegisterSaver_LiveFloatReg( F5 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
137 RegisterSaver_LiveFloatReg( F6 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
138 RegisterSaver_LiveFloatReg( F7 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
139 RegisterSaver_LiveFloatReg( F8 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
140 RegisterSaver_LiveFloatReg( F9 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
141 RegisterSaver_LiveFloatReg( F10 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
142 RegisterSaver_LiveFloatReg( F11 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
143 RegisterSaver_LiveFloatReg( F12 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
144 RegisterSaver_LiveFloatReg( F13 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
145 RegisterSaver_LiveFloatReg( F14 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
146 RegisterSaver_LiveFloatReg( F15 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
147 RegisterSaver_LiveFloatReg( F16 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
148 RegisterSaver_LiveFloatReg( F17 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
149 RegisterSaver_LiveFloatReg( F18 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
150 RegisterSaver_LiveFloatReg( F19 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
151 RegisterSaver_LiveFloatReg( F20 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
152 RegisterSaver_LiveFloatReg( F21 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
153 RegisterSaver_LiveFloatReg( F22 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
154 RegisterSaver_LiveFloatReg( F23 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
155 RegisterSaver_LiveFloatReg( F24 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
156 RegisterSaver_LiveFloatReg( F25 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
157 RegisterSaver_LiveFloatReg( F26 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
158 RegisterSaver_LiveFloatReg( F27 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
159 RegisterSaver_LiveFloatReg( F28 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
160 RegisterSaver_LiveFloatReg( F29 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
161 RegisterSaver_LiveFloatReg( F30 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
162 RegisterSaver_LiveFloatReg( F31 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
163 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
164 // live integer registers: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
165 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
166 RegisterSaver_LiveIntReg( R0 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
167 //RegisterSaver_LiveIntReg( R1 ), // stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
168 RegisterSaver_LiveIntReg( R2 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
169 RegisterSaver_LiveIntReg( R3 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
170 RegisterSaver_LiveIntReg( R4 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
171 RegisterSaver_LiveIntReg( R5 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
172 RegisterSaver_LiveIntReg( R6 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
173 RegisterSaver_LiveIntReg( R7 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
174 RegisterSaver_LiveIntReg( R8 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
175 RegisterSaver_LiveIntReg( R9 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
176 RegisterSaver_LiveIntReg( R10 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
177 RegisterSaver_LiveIntReg( R11 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
178 RegisterSaver_LiveIntReg( R12 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
179 //RegisterSaver_LiveIntReg( R13 ), // system thread id |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
180 RegisterSaver_LiveIntReg( R14 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
181 RegisterSaver_LiveIntReg( R15 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
182 RegisterSaver_LiveIntReg( R16 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
183 RegisterSaver_LiveIntReg( R17 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
184 RegisterSaver_LiveIntReg( R18 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
185 RegisterSaver_LiveIntReg( R19 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
186 RegisterSaver_LiveIntReg( R20 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
187 RegisterSaver_LiveIntReg( R21 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
188 RegisterSaver_LiveIntReg( R22 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
189 RegisterSaver_LiveIntReg( R23 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
190 RegisterSaver_LiveIntReg( R24 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
191 RegisterSaver_LiveIntReg( R25 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
192 RegisterSaver_LiveIntReg( R26 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
193 RegisterSaver_LiveIntReg( R27 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
194 RegisterSaver_LiveIntReg( R28 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
195 RegisterSaver_LiveIntReg( R29 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
196 RegisterSaver_LiveIntReg( R31 ), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
197 RegisterSaver_LiveIntReg( R30 ), // r30 must be the last register |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
198 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
199 |
14684 | 200 OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssembler* masm, |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
201 int* out_frame_size_in_bytes, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
202 bool generate_oop_map, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
203 int return_pc_adjustment, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
204 ReturnPCLocation return_pc_location) { |
14684 | 205 // Push an abi_reg_args-frame and store all registers which may be live. |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
206 // If requested, create an OopMap: Record volatile registers as |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
207 // callee-save values in an OopMap so their save locations will be |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
208 // propagated to the RegisterMap of the caller frame during |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
209 // StackFrameStream construction (needed for deoptimization; see |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
210 // compiledVFrame::create_stack_value). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
211 // If return_pc_adjustment != 0 adjust the return pc by return_pc_adjustment. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
212 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
213 int i; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
214 int offset; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
215 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
216 // calcualte frame size |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
217 const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
218 sizeof(RegisterSaver::LiveRegType); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
219 const int register_save_size = regstosave_num * reg_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
220 const int frame_size_in_bytes = round_to(register_save_size, frame::alignment_in_bytes) |
14684 | 221 + frame::abi_reg_args_size; |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
222 *out_frame_size_in_bytes = frame_size_in_bytes; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
223 const int frame_size_in_slots = frame_size_in_bytes / sizeof(jint); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
224 const int register_save_offset = frame_size_in_bytes - register_save_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
225 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
226 // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
227 OopMap* map = generate_oop_map ? new OopMap(frame_size_in_slots, 0) : NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
228 |
14684 | 229 BLOCK_COMMENT("push_frame_reg_args_and_save_live_registers {"); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
230 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
231 // Save r30 in the last slot of the not yet pushed frame so that we |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
232 // can use it as scratch reg. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
233 __ std(R30, -reg_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
234 assert(-reg_size == register_save_offset - frame_size_in_bytes + ((regstosave_num-1)*reg_size), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
235 "consistency check"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
236 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
237 // save the flags |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
238 // Do the save_LR_CR by hand and adjust the return pc if requested. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
239 __ mfcr(R30); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
240 __ std(R30, _abi(cr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
241 switch (return_pc_location) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
242 case return_pc_is_lr: __ mflr(R30); break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
243 case return_pc_is_r4: __ mr(R30, R4); break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
244 case return_pc_is_thread_saved_exception_pc: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
245 __ ld(R30, thread_(saved_exception_pc)); break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
246 default: ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
247 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
248 if (return_pc_adjustment != 0) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
249 __ addi(R30, R30, return_pc_adjustment); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
250 __ std(R30, _abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
251 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
252 // push a new frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
253 __ push_frame(frame_size_in_bytes, R30); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
254 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
255 // save all registers (ints and floats) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
256 offset = register_save_offset; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
257 for (int i = 0; i < regstosave_num; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
258 int reg_num = RegisterSaver_LiveRegs[i].reg_num; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
259 int reg_type = RegisterSaver_LiveRegs[i].reg_type; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
260 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
261 switch (reg_type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
262 case RegisterSaver::int_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
263 if (reg_num != 30) { // We spilled R30 right at the beginning. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
264 __ std(as_Register(reg_num), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
265 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
266 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
267 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
268 case RegisterSaver::float_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
269 __ stfd(as_FloatRegister(reg_num), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
270 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
271 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
272 case RegisterSaver::special_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
273 if (reg_num == SR_CTR_SpecialRegisterEnumValue) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
274 __ mfctr(R30); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
275 __ std(R30, offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
276 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
277 Unimplemented(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
278 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
279 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
280 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
281 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
282 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
283 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
284 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
285 if (generate_oop_map) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
286 map->set_callee_saved(VMRegImpl::stack2reg(offset>>2), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
287 RegisterSaver_LiveRegs[i].vmreg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
288 map->set_callee_saved(VMRegImpl::stack2reg((offset + half_reg_size)>>2), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
289 RegisterSaver_LiveRegs[i].vmreg->next()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
290 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
291 offset += reg_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
292 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
293 |
14684 | 294 BLOCK_COMMENT("} push_frame_reg_args_and_save_live_registers"); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
295 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
296 // And we're done. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
297 return map; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
298 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
299 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
300 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
301 // Pop the current frame and restore all the registers that we |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
302 // saved. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
303 void RegisterSaver::restore_live_registers_and_pop_frame(MacroAssembler* masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
304 int frame_size_in_bytes, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
305 bool restore_ctr) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
306 int i; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
307 int offset; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
308 const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
309 sizeof(RegisterSaver::LiveRegType); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
310 const int register_save_size = regstosave_num * reg_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
311 const int register_save_offset = frame_size_in_bytes - register_save_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
312 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
313 BLOCK_COMMENT("restore_live_registers_and_pop_frame {"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
314 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
315 // restore all registers (ints and floats) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
316 offset = register_save_offset; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
317 for (int i = 0; i < regstosave_num; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
318 int reg_num = RegisterSaver_LiveRegs[i].reg_num; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
319 int reg_type = RegisterSaver_LiveRegs[i].reg_type; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
320 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
321 switch (reg_type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
322 case RegisterSaver::int_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
323 if (reg_num != 30) // R30 restored at the end, it's the tmp reg! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
324 __ ld(as_Register(reg_num), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
325 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
326 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
327 case RegisterSaver::float_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
328 __ lfd(as_FloatRegister(reg_num), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
329 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
330 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
331 case RegisterSaver::special_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
332 if (reg_num == SR_CTR_SpecialRegisterEnumValue) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
333 if (restore_ctr) { // Nothing to do here if ctr already contains the next address. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
334 __ ld(R30, offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
335 __ mtctr(R30); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
336 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
337 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
338 Unimplemented(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
339 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
340 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
341 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
342 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
343 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
344 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
345 offset += reg_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
346 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
347 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
348 // pop the frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
349 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
350 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
351 // restore the flags |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
352 __ restore_LR_CR(R30); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
353 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
354 // restore scratch register's value |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
355 __ ld(R30, -reg_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
356 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
357 BLOCK_COMMENT("} restore_live_registers_and_pop_frame"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
358 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
359 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
360 void RegisterSaver::push_frame_and_save_argument_registers(MacroAssembler* masm, Register r_temp, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
361 int frame_size,int total_args, const VMRegPair *regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
362 const VMRegPair *regs2) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
363 __ push_frame(frame_size, r_temp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
364 int st_off = frame_size - wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
365 for (int i = 0; i < total_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
366 VMReg r_1 = regs[i].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
367 VMReg r_2 = regs[i].second(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
368 if (!r_1->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
369 assert(!r_2->is_valid(), ""); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
370 continue; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
371 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
372 if (r_1->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
373 Register r = r_1->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
374 __ std(r, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
375 st_off -= wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
376 } else if (r_1->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
377 FloatRegister f = r_1->as_FloatRegister(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
378 __ stfd(f, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
379 st_off -= wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
380 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
381 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
382 if (regs2 != NULL) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
383 for (int i = 0; i < total_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
384 VMReg r_1 = regs2[i].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
385 VMReg r_2 = regs2[i].second(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
386 if (!r_1->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
387 assert(!r_2->is_valid(), ""); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
388 continue; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
389 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
390 if (r_1->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
391 Register r = r_1->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
392 __ std(r, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
393 st_off -= wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
394 } else if (r_1->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
395 FloatRegister f = r_1->as_FloatRegister(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
396 __ stfd(f, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
397 st_off -= wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
398 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
399 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
400 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
401 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
402 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
403 void RegisterSaver::restore_argument_registers_and_pop_frame(MacroAssembler*masm, int frame_size, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
404 int total_args, const VMRegPair *regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
405 const VMRegPair *regs2) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
406 int st_off = frame_size - wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
407 for (int i = 0; i < total_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
408 VMReg r_1 = regs[i].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
409 VMReg r_2 = regs[i].second(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
410 if (r_1->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
411 Register r = r_1->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
412 __ ld(r, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
413 st_off -= wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
414 } else if (r_1->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
415 FloatRegister f = r_1->as_FloatRegister(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
416 __ lfd(f, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
417 st_off -= wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
418 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
419 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
420 if (regs2 != NULL) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
421 for (int i = 0; i < total_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
422 VMReg r_1 = regs2[i].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
423 VMReg r_2 = regs2[i].second(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
424 if (r_1->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
425 Register r = r_1->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
426 __ ld(r, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
427 st_off -= wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
428 } else if (r_1->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
429 FloatRegister f = r_1->as_FloatRegister(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
430 __ lfd(f, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
431 st_off -= wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
432 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
433 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
434 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
435 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
436 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
437 // Restore the registers that might be holding a result. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
438 void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
439 int i; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
440 int offset; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
441 const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
442 sizeof(RegisterSaver::LiveRegType); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
443 const int register_save_size = regstosave_num * reg_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
444 const int register_save_offset = frame_size_in_bytes - register_save_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
445 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
446 // restore all result registers (ints and floats) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
447 offset = register_save_offset; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
448 for (int i = 0; i < regstosave_num; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
449 int reg_num = RegisterSaver_LiveRegs[i].reg_num; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
450 int reg_type = RegisterSaver_LiveRegs[i].reg_type; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
451 switch (reg_type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
452 case RegisterSaver::int_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
453 if (as_Register(reg_num)==R3_RET) // int result_reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
454 __ ld(as_Register(reg_num), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
455 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
456 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
457 case RegisterSaver::float_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
458 if (as_FloatRegister(reg_num)==F1_RET) // float result_reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
459 __ lfd(as_FloatRegister(reg_num), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
460 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
461 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
462 case RegisterSaver::special_reg: { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
463 // Special registers don't hold a result. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
464 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
465 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
466 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
467 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
468 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
469 offset += reg_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
470 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
471 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
472 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
473 // Is vector's size (in bytes) bigger than a size saved by default? |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
474 bool SharedRuntime::is_wide_vector(int size) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
475 ResourceMark rm; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
476 // Note, MaxVectorSize == 8 on PPC64. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
477 assert(size <= 8, err_msg_res("%d bytes vectors are not supported", size)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
478 return size > 8; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
479 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
480 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
481 static int reg2slot(VMReg r) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
482 return r->reg2stack() + SharedRuntime::out_preserve_stack_slots(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
483 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
484 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
485 static int reg2offset(VMReg r) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
486 return (r->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
487 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
488 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
489 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
490 // --------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
491 // Read the array of BasicTypes from a signature, and compute where the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
492 // arguments should go. Values in the VMRegPair regs array refer to 4-byte |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
493 // quantities. Values less than VMRegImpl::stack0 are registers, those above |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
494 // refer to 4-byte stack slots. All stack slots are based off of the stack pointer |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
495 // as framesizes are fixed. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
496 // VMRegImpl::stack0 refers to the first slot 0(sp). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
497 // and VMRegImpl::stack0+1 refers to the memory word 4-bytes higher. Register |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
498 // up to RegisterImpl::number_of_registers) are the 64-bit |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
499 // integer registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
500 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
501 // Note: the INPUTS in sig_bt are in units of Java argument words, which are |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
502 // either 32-bit or 64-bit depending on the build. The OUTPUTS are in 32-bit |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
503 // units regardless of build. Of course for i486 there is no 64 bit build |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
504 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
505 // The Java calling convention is a "shifted" version of the C ABI. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
506 // By skipping the first C ABI register we can call non-static jni methods |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
507 // with small numbers of arguments without having to shuffle the arguments |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
508 // at all. Since we control the java ABI we ought to at least get some |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
509 // advantage out of it. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
510 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
511 const VMReg java_iarg_reg[8] = { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
512 R3->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
513 R4->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
514 R5->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
515 R6->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
516 R7->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
517 R8->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
518 R9->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
519 R10->as_VMReg() |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
520 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
521 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
522 const VMReg java_farg_reg[13] = { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
523 F1->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
524 F2->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
525 F3->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
526 F4->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
527 F5->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
528 F6->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
529 F7->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
530 F8->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
531 F9->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
532 F10->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
533 F11->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
534 F12->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
535 F13->as_VMReg() |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
536 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
537 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
538 const int num_java_iarg_registers = sizeof(java_iarg_reg) / sizeof(java_iarg_reg[0]); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
539 const int num_java_farg_registers = sizeof(java_farg_reg) / sizeof(java_farg_reg[0]); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
540 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
541 int SharedRuntime::java_calling_convention(const BasicType *sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
542 VMRegPair *regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
543 int total_args_passed, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
544 int is_outgoing) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
545 // C2c calling conventions for compiled-compiled calls. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
546 // Put 8 ints/longs into registers _AND_ 13 float/doubles into |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
547 // registers _AND_ put the rest on the stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
548 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
549 const int inc_stk_for_intfloat = 1; // 1 slots for ints and floats |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
550 const int inc_stk_for_longdouble = 2; // 2 slots for longs and doubles |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
551 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
552 int i; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
553 VMReg reg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
554 int stk = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
555 int ireg = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
556 int freg = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
557 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
558 // We put the first 8 arguments into registers and the rest on the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
559 // stack, float arguments are already in their argument registers |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
560 // due to c2c calling conventions (see calling_convention). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
561 for (int i = 0; i < total_args_passed; ++i) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
562 switch(sig_bt[i]) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
563 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
564 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
565 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
566 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
567 case T_INT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
568 if (ireg < num_java_iarg_registers) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
569 // Put int/ptr in register |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
570 reg = java_iarg_reg[ireg]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
571 ++ireg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
572 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
573 // Put int/ptr on stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
574 reg = VMRegImpl::stack2reg(stk); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
575 stk += inc_stk_for_intfloat; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
576 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
577 regs[i].set1(reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
578 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
579 case T_LONG: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
580 assert(sig_bt[i+1] == T_VOID, "expecting half"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
581 if (ireg < num_java_iarg_registers) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
582 // Put long in register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
583 reg = java_iarg_reg[ireg]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
584 ++ireg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
585 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
586 // Put long on stack. They must be aligned to 2 slots. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
587 if (stk & 0x1) ++stk; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
588 reg = VMRegImpl::stack2reg(stk); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
589 stk += inc_stk_for_longdouble; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
590 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
591 regs[i].set2(reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
592 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
593 case T_OBJECT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
594 case T_ARRAY: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
595 case T_ADDRESS: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
596 if (ireg < num_java_iarg_registers) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
597 // Put ptr in register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
598 reg = java_iarg_reg[ireg]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
599 ++ireg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
600 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
601 // Put ptr on stack. Objects must be aligned to 2 slots too, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
602 // because "64-bit pointers record oop-ishness on 2 aligned |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
603 // adjacent registers." (see OopFlow::build_oop_map). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
604 if (stk & 0x1) ++stk; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
605 reg = VMRegImpl::stack2reg(stk); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
606 stk += inc_stk_for_longdouble; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
607 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
608 regs[i].set2(reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
609 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
610 case T_FLOAT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
611 if (freg < num_java_farg_registers) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
612 // Put float in register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
613 reg = java_farg_reg[freg]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
614 ++freg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
615 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
616 // Put float on stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
617 reg = VMRegImpl::stack2reg(stk); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
618 stk += inc_stk_for_intfloat; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
619 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
620 regs[i].set1(reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
621 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
622 case T_DOUBLE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
623 assert(sig_bt[i+1] == T_VOID, "expecting half"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
624 if (freg < num_java_farg_registers) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
625 // Put double in register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
626 reg = java_farg_reg[freg]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
627 ++freg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
628 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
629 // Put double on stack. They must be aligned to 2 slots. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
630 if (stk & 0x1) ++stk; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
631 reg = VMRegImpl::stack2reg(stk); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
632 stk += inc_stk_for_longdouble; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
633 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
634 regs[i].set2(reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
635 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
636 case T_VOID: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
637 // Do not count halves. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
638 regs[i].set_bad(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
639 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
640 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
641 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
642 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
643 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
644 return round_to(stk, 2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
645 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
646 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
647 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
648 // Calling convention for calling C code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
649 int SharedRuntime::c_calling_convention(const BasicType *sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
650 VMRegPair *regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
651 VMRegPair *regs2, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
652 int total_args_passed) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
653 // Calling conventions for C runtime calls and calls to JNI native methods. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
654 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
655 // PPC64 convention: Hoist the first 8 int/ptr/long's in the first 8 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
656 // int regs, leaving int regs undefined if the arg is flt/dbl. Hoist |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
657 // the first 13 flt/dbl's in the first 13 fp regs but additionally |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
658 // copy flt/dbl to the stack if they are beyond the 8th argument. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
659 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
660 const VMReg iarg_reg[8] = { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
661 R3->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
662 R4->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
663 R5->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
664 R6->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
665 R7->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
666 R8->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
667 R9->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
668 R10->as_VMReg() |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
669 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
670 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
671 const VMReg farg_reg[13] = { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
672 F1->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
673 F2->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
674 F3->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
675 F4->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
676 F5->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
677 F6->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
678 F7->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
679 F8->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
680 F9->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
681 F10->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
682 F11->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
683 F12->as_VMReg(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
684 F13->as_VMReg() |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
685 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
686 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
687 // Check calling conventions consistency. |
14445 | 688 assert(sizeof(iarg_reg) / sizeof(iarg_reg[0]) == Argument::n_int_register_parameters_c && |
689 sizeof(farg_reg) / sizeof(farg_reg[0]) == Argument::n_float_register_parameters_c, | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
690 "consistency"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
691 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
692 // `Stk' counts stack slots. Due to alignment, 32 bit values occupy |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
693 // 2 such slots, like 64 bit values do. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
694 const int inc_stk_for_intfloat = 2; // 2 slots for ints and floats |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
695 const int inc_stk_for_longdouble = 2; // 2 slots for longs and doubles |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
696 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
697 int i; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
698 VMReg reg; |
14684 | 699 // Leave room for C-compatible ABI_REG_ARGS. |
700 int stk = (frame::abi_reg_args_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size; | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
701 int arg = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
702 int freg = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
703 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
704 // Avoid passing C arguments in the wrong stack slots. |
14684 | 705 #if defined(ABI_ELFv2) |
706 assert((SharedRuntime::out_preserve_stack_slots() + stk) * VMRegImpl::stack_slot_size == 96, | |
707 "passing C arguments in wrong stack slots"); | |
708 #else | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
709 assert((SharedRuntime::out_preserve_stack_slots() + stk) * VMRegImpl::stack_slot_size == 112, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
710 "passing C arguments in wrong stack slots"); |
14684 | 711 #endif |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
712 // We fill-out regs AND regs2 if an argument must be passed in a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
713 // register AND in a stack slot. If regs2 is NULL in such a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
714 // situation, we bail-out with a fatal error. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
715 for (int i = 0; i < total_args_passed; ++i, ++arg) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
716 // Initialize regs2 to BAD. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
717 if (regs2 != NULL) regs2[i].set_bad(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
718 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
719 switch(sig_bt[i]) { |
14445 | 720 |
721 // | |
722 // If arguments 0-7 are integers, they are passed in integer registers. | |
723 // Argument i is placed in iarg_reg[i]. | |
724 // | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
725 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
726 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
727 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
728 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
729 case T_INT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
730 // We must cast ints to longs and use full 64 bit stack slots |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
731 // here. We do the cast in GraphKit::gen_stub() and just guard |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
732 // here against loosing that change. |
14418
cfd05ec74089
8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
goetz
parents:
14408
diff
changeset
|
733 assert(CCallingConventionRequiresIntsAsLongs, |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
734 "argument of type int should be promoted to type long"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
735 guarantee(i > 0 && sig_bt[i-1] == T_LONG, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
736 "argument of type (bt) should have been promoted to type (T_LONG,bt) for bt in " |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
737 "{T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
738 // Do not count halves. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
739 regs[i].set_bad(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
740 --arg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
741 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
742 case T_LONG: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
743 guarantee(sig_bt[i+1] == T_VOID || |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
744 sig_bt[i+1] == T_BOOLEAN || sig_bt[i+1] == T_CHAR || |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
745 sig_bt[i+1] == T_BYTE || sig_bt[i+1] == T_SHORT || |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
746 sig_bt[i+1] == T_INT, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
747 "expecting type (T_LONG,half) or type (T_LONG,bt) with bt in {T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
748 case T_OBJECT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
749 case T_ARRAY: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
750 case T_ADDRESS: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
751 case T_METADATA: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
752 // Oops are already boxed if required (JNI). |
14445 | 753 if (arg < Argument::n_int_register_parameters_c) { |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
754 reg = iarg_reg[arg]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
755 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
756 reg = VMRegImpl::stack2reg(stk); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
757 stk += inc_stk_for_longdouble; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
758 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
759 regs[i].set2(reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
760 break; |
14445 | 761 |
762 // | |
763 // Floats are treated differently from int regs: The first 13 float arguments | |
764 // are passed in registers (not the float args among the first 13 args). | |
765 // Thus argument i is NOT passed in farg_reg[i] if it is float. It is passed | |
766 // in farg_reg[j] if argument i is the j-th float argument of this call. | |
767 // | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
768 case T_FLOAT: |
23460
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
769 #if defined(LINUX) |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
770 // Linux uses ELF ABI. Both original ELF and ELFv2 ABIs have float |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
771 // in the least significant word of an argument slot. |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
772 #if defined(VM_LITTLE_ENDIAN) |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
773 #define FLOAT_WORD_OFFSET_IN_SLOT 0 |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
774 #else |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
775 #define FLOAT_WORD_OFFSET_IN_SLOT 1 |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
776 #endif |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
777 #elif defined(AIX) |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
778 // Although AIX runs on big endian CPU, float is in the most |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
779 // significant word of an argument slot. |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
780 #define FLOAT_WORD_OFFSET_IN_SLOT 0 |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
781 #else |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
782 #error "unknown OS" |
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
783 #endif |
14445 | 784 if (freg < Argument::n_float_register_parameters_c) { |
785 // Put float in register ... | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
786 reg = farg_reg[freg]; |
14445 | 787 ++freg; |
788 | |
789 // Argument i for i > 8 is placed on the stack even if it's | |
790 // placed in a register (if it's a float arg). Aix disassembly | |
791 // shows that xlC places these float args on the stack AND in | |
792 // a register. This is not documented, but we follow this | |
793 // convention, too. | |
794 if (arg >= Argument::n_regs_not_on_stack_c) { | |
795 // ... and on the stack. | |
796 guarantee(regs2 != NULL, "must pass float in register and stack slot"); | |
23460
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
797 VMReg reg2 = VMRegImpl::stack2reg(stk + FLOAT_WORD_OFFSET_IN_SLOT); |
14445 | 798 regs2[i].set1(reg2); |
799 stk += inc_stk_for_intfloat; | |
800 } | |
801 | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
802 } else { |
14445 | 803 // Put float on stack. |
23460
e9e252c83b2b
8139258: PPC64LE: argument passing problem when passing 15 floats in native call
goetz
parents:
17809
diff
changeset
|
804 reg = VMRegImpl::stack2reg(stk + FLOAT_WORD_OFFSET_IN_SLOT); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
805 stk += inc_stk_for_intfloat; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
806 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
807 regs[i].set1(reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
808 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
809 case T_DOUBLE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
810 assert(sig_bt[i+1] == T_VOID, "expecting half"); |
14445 | 811 if (freg < Argument::n_float_register_parameters_c) { |
812 // Put double in register ... | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
813 reg = farg_reg[freg]; |
14445 | 814 ++freg; |
815 | |
816 // Argument i for i > 8 is placed on the stack even if it's | |
817 // placed in a register (if it's a double arg). Aix disassembly | |
818 // shows that xlC places these float args on the stack AND in | |
819 // a register. This is not documented, but we follow this | |
820 // convention, too. | |
821 if (arg >= Argument::n_regs_not_on_stack_c) { | |
822 // ... and on the stack. | |
823 guarantee(regs2 != NULL, "must pass float in register and stack slot"); | |
824 VMReg reg2 = VMRegImpl::stack2reg(stk); | |
825 regs2[i].set2(reg2); | |
826 stk += inc_stk_for_longdouble; | |
827 } | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
828 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
829 // Put double on stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
830 reg = VMRegImpl::stack2reg(stk); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
831 stk += inc_stk_for_longdouble; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
832 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
833 regs[i].set2(reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
834 break; |
14445 | 835 |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
836 case T_VOID: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
837 // Do not count halves. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
838 regs[i].set_bad(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
839 --arg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
840 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
841 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
842 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
843 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
844 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
845 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
846 return round_to(stk, 2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
847 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
848 #endif // COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
849 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
850 static address gen_c2i_adapter(MacroAssembler *masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
851 int total_args_passed, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
852 int comp_args_on_stack, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
853 const BasicType *sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
854 const VMRegPair *regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
855 Label& call_interpreter, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
856 const Register& ientry) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
857 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
858 address c2i_entrypoint; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
859 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
860 const Register sender_SP = R21_sender_SP; // == R21_tmp1 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
861 const Register code = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
862 //const Register ientry = R23_tmp3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
863 const Register value_regs[] = { R24_tmp4, R25_tmp5, R26_tmp6 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
864 const int num_value_regs = sizeof(value_regs) / sizeof(Register); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
865 int value_regs_index = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
866 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
867 const Register return_pc = R27_tmp7; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
868 const Register tmp = R28_tmp8; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
869 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
870 assert_different_registers(sender_SP, code, ientry, return_pc, tmp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
871 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
872 // Adapter needs TOP_IJAVA_FRAME_ABI. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
873 const int adapter_size = frame::top_ijava_frame_abi_size + |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
874 round_to(total_args_passed * wordSize, frame::alignment_in_bytes); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
875 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
876 // regular (verified) c2i entry point |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
877 c2i_entrypoint = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
878 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
879 // Does compiled code exists? If yes, patch the caller's callsite. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
880 __ ld(code, method_(code)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
881 __ cmpdi(CCR0, code, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
882 __ ld(ientry, method_(interpreter_entry)); // preloaded |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
883 __ beq(CCR0, call_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
884 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
885 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
886 // Patch caller's callsite, method_(code) was not NULL which means that |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
887 // compiled code exists. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
888 __ mflr(return_pc); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
889 __ std(return_pc, _abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
890 RegisterSaver::push_frame_and_save_argument_registers(masm, tmp, adapter_size, total_args_passed, regs); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
891 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
892 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::fixup_callers_callsite), R19_method, return_pc); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
893 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
894 RegisterSaver::restore_argument_registers_and_pop_frame(masm, adapter_size, total_args_passed, regs); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
895 __ ld(return_pc, _abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
896 __ ld(ientry, method_(interpreter_entry)); // preloaded |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
897 __ mtlr(return_pc); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
898 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
899 |
14445 | 900 // Call the interpreter. |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
901 __ BIND(call_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
902 __ mtctr(ientry); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
903 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
904 // Get a copy of the current SP for loading caller's arguments. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
905 __ mr(sender_SP, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
906 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
907 // Add space for the adapter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
908 __ resize_frame(-adapter_size, R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
909 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
910 int st_off = adapter_size - wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
911 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
912 // Write the args into the outgoing interpreter space. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
913 for (int i = 0; i < total_args_passed; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
914 VMReg r_1 = regs[i].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
915 VMReg r_2 = regs[i].second(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
916 if (!r_1->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
917 assert(!r_2->is_valid(), ""); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
918 continue; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
919 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
920 if (r_1->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
921 Register tmp_reg = value_regs[value_regs_index]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
922 value_regs_index = (value_regs_index + 1) % num_value_regs; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
923 // The calling convention produces OptoRegs that ignore the out |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
924 // preserve area (JIT's ABI). We must account for it here. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
925 int ld_off = (r_1->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
926 if (!r_2->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
927 __ lwz(tmp_reg, ld_off, sender_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
928 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
929 __ ld(tmp_reg, ld_off, sender_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
930 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
931 // Pretend stack targets were loaded into tmp_reg. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
932 r_1 = tmp_reg->as_VMReg(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
933 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
934 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
935 if (r_1->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
936 Register r = r_1->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
937 if (!r_2->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
938 __ stw(r, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
939 st_off-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
940 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
941 // Longs are given 2 64-bit slots in the interpreter, but the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
942 // data is passed in only 1 slot. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
943 if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
944 DEBUG_ONLY( __ li(tmp, 0); __ std(tmp, st_off, R1_SP); ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
945 st_off-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
946 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
947 __ std(r, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
948 st_off-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
949 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
950 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
951 assert(r_1->is_FloatRegister(), ""); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
952 FloatRegister f = r_1->as_FloatRegister(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
953 if (!r_2->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
954 __ stfs(f, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
955 st_off-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
956 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
957 // In 64bit, doubles are given 2 64-bit slots in the interpreter, but the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
958 // data is passed in only 1 slot. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
959 // One of these should get known junk... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
960 DEBUG_ONLY( __ li(tmp, 0); __ std(tmp, st_off, R1_SP); ) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
961 st_off-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
962 __ stfd(f, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
963 st_off-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
964 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
965 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
966 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
967 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
968 // Jump to the interpreter just as if interpreter was doing it. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
969 |
14445 | 970 #ifdef CC_INTERP |
971 const Register tos = R17_tos; | |
14694 | 972 #else |
973 const Register tos = R15_esp; | |
974 __ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); | |
14445 | 975 #endif |
976 | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
977 // load TOS |
14445 | 978 __ addi(tos, R1_SP, st_off); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
979 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
980 // Frame_manager expects initial_caller_sp (= SP without resize by c2i) in R21_tmp1. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
981 assert(sender_SP == R21_sender_SP, "passing initial caller's SP in wrong register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
982 __ bctr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
983 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
984 return c2i_entrypoint; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
985 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
986 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
987 static void gen_i2c_adapter(MacroAssembler *masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
988 int total_args_passed, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
989 int comp_args_on_stack, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
990 const BasicType *sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
991 const VMRegPair *regs) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
992 |
14694 | 993 // Load method's entry-point from method. |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
994 __ ld(R12_scratch2, in_bytes(Method::from_compiled_offset()), R19_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
995 __ mtctr(R12_scratch2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
996 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
997 // We will only enter here from an interpreted frame and never from after |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
998 // passing thru a c2i. Azul allowed this but we do not. If we lose the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
999 // race and use a c2i we will remain interpreted for the race loser(s). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1000 // This removes all sorts of headaches on the x86 side and also eliminates |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1001 // the possibility of having c2i -> i2c -> c2i -> ... endless transitions. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1002 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1003 // Note: r13 contains the senderSP on entry. We must preserve it since |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1004 // we may do a i2c -> c2i transition if we lose a race where compiled |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1005 // code goes non-entrant while we get args ready. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1006 // In addition we use r13 to locate all the interpreter args as |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1007 // we must align the stack to 16 bytes on an i2c entry else we |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1008 // lose alignment we expect in all compiled code and register |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1009 // save code can segv when fxsave instructions find improperly |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1010 // aligned stack pointer. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1011 |
14445 | 1012 #ifdef CC_INTERP |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1013 const Register ld_ptr = R17_tos; |
14694 | 1014 #else |
1015 const Register ld_ptr = R15_esp; | |
14445 | 1016 #endif |
14694 | 1017 |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1018 const Register value_regs[] = { R22_tmp2, R23_tmp3, R24_tmp4, R25_tmp5, R26_tmp6 }; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1019 const int num_value_regs = sizeof(value_regs) / sizeof(Register); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1020 int value_regs_index = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1021 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1022 int ld_offset = total_args_passed*wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1023 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1024 // Cut-out for having no stack args. Since up to 2 int/oop args are passed |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1025 // in registers, we will occasionally have no stack args. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1026 int comp_words_on_stack = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1027 if (comp_args_on_stack) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1028 // Sig words on the stack are greater-than VMRegImpl::stack0. Those in |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1029 // registers are below. By subtracting stack0, we either get a negative |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1030 // number (all values in registers) or the maximum stack slot accessed. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1031 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1032 // Convert 4-byte c2 stack slots to words. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1033 comp_words_on_stack = round_to(comp_args_on_stack*VMRegImpl::stack_slot_size, wordSize)>>LogBytesPerWord; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1034 // Round up to miminum stack alignment, in wordSize. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1035 comp_words_on_stack = round_to(comp_words_on_stack, 2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1036 __ resize_frame(-comp_words_on_stack * wordSize, R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1037 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1038 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1039 // Now generate the shuffle code. Pick up all register args and move the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1040 // rest through register value=Z_R12. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1041 BLOCK_COMMENT("Shuffle arguments"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1042 for (int i = 0; i < total_args_passed; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1043 if (sig_bt[i] == T_VOID) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1044 assert(i > 0 && (sig_bt[i-1] == T_LONG || sig_bt[i-1] == T_DOUBLE), "missing half"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1045 continue; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1046 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1047 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1048 // Pick up 0, 1 or 2 words from ld_ptr. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1049 assert(!regs[i].second()->is_valid() || regs[i].first()->next() == regs[i].second(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1050 "scrambled load targets?"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1051 VMReg r_1 = regs[i].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1052 VMReg r_2 = regs[i].second(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1053 if (!r_1->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1054 assert(!r_2->is_valid(), ""); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1055 continue; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1056 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1057 if (r_1->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1058 if (!r_2->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1059 __ lfs(r_1->as_FloatRegister(), ld_offset, ld_ptr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1060 ld_offset-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1061 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1062 // Skip the unused interpreter slot. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1063 __ lfd(r_1->as_FloatRegister(), ld_offset-wordSize, ld_ptr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1064 ld_offset-=2*wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1065 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1066 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1067 Register r; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1068 if (r_1->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1069 // Must do a memory to memory move thru "value". |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1070 r = value_regs[value_regs_index]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1071 value_regs_index = (value_regs_index + 1) % num_value_regs; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1072 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1073 r = r_1->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1074 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1075 if (!r_2->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1076 // Not sure we need to do this but it shouldn't hurt. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1077 if (sig_bt[i] == T_OBJECT || sig_bt[i] == T_ADDRESS || sig_bt[i] == T_ARRAY) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1078 __ ld(r, ld_offset, ld_ptr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1079 ld_offset-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1080 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1081 __ lwz(r, ld_offset, ld_ptr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1082 ld_offset-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1083 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1084 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1085 // In 64bit, longs are given 2 64-bit slots in the interpreter, but the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1086 // data is passed in only 1 slot. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1087 if (sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1088 ld_offset-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1089 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1090 __ ld(r, ld_offset, ld_ptr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1091 ld_offset-=wordSize; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1092 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1093 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1094 if (r_1->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1095 // Now store value where the compiler expects it |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1096 int st_off = (r_1->reg2stack() + SharedRuntime::out_preserve_stack_slots())*VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1097 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1098 if (sig_bt[i] == T_INT || sig_bt[i] == T_FLOAT ||sig_bt[i] == T_BOOLEAN || |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1099 sig_bt[i] == T_SHORT || sig_bt[i] == T_CHAR || sig_bt[i] == T_BYTE) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1100 __ stw(r, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1101 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1102 __ std(r, st_off, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1103 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1104 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1105 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1106 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1107 |
14694 | 1108 BLOCK_COMMENT("Store method"); |
1109 // Store method into thread->callee_target. | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1110 // We might end up in handle_wrong_method if the callee is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1111 // deoptimized as we race thru here. If that happens we don't want |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1112 // to take a safepoint because the caller frame will look |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1113 // interpreted and arguments are now "compiled" so it is much better |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1114 // to make this transition invisible to the stack walking |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1115 // code. Unfortunately if we try and find the callee by normal means |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1116 // a safepoint is possible. So we stash the desired callee in the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1117 // thread and the vm will find there should this case occur. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1118 __ std(R19_method, thread_(callee_target)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1119 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1120 // Jump to the compiled code just as if compiled code was doing it. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1121 __ bctr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1122 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1123 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1124 AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1125 int total_args_passed, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1126 int comp_args_on_stack, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1127 const BasicType *sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1128 const VMRegPair *regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1129 AdapterFingerPrint* fingerprint) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1130 address i2c_entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1131 address c2i_unverified_entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1132 address c2i_entry; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1133 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1134 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1135 // entry: i2c |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1136 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1137 __ align(CodeEntryAlignment); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1138 i2c_entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1139 gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1140 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1141 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1142 // entry: c2i unverified |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1143 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1144 __ align(CodeEntryAlignment); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1145 BLOCK_COMMENT("c2i unverified entry"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1146 c2i_unverified_entry = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1147 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1148 // inline_cache contains a compiledICHolder |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1149 const Register ic = R19_method; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1150 const Register ic_klass = R11_scratch1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1151 const Register receiver_klass = R12_scratch2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1152 const Register code = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1153 const Register ientry = R23_tmp3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1154 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1155 assert_different_registers(ic, ic_klass, receiver_klass, R3_ARG1, code, ientry); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1156 assert(R11_scratch1 == R11, "need prologue scratch register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1157 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1158 Label call_interpreter; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1159 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1160 assert(!MacroAssembler::needs_explicit_null_check(oopDesc::klass_offset_in_bytes()), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1161 "klass offset should reach into any page"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1162 // Check for NULL argument if we don't have implicit null checks. |
14436
b0133e4187d3
8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents:
14418
diff
changeset
|
1163 if (!ImplicitNullChecks || !os::zero_page_read_protected()) { |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1164 if (TrapBasedNullChecks) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1165 __ trap_null_check(R3_ARG1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1166 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1167 Label valid; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1168 __ cmpdi(CCR0, R3_ARG1, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1169 __ bne_predict_taken(CCR0, valid); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1170 // We have a null argument, branch to ic_miss_stub. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1171 __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(), |
14445 | 1172 relocInfo::runtime_call_type); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1173 __ BIND(valid); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1174 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1175 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1176 // Assume argument is not NULL, load klass from receiver. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1177 __ load_klass(receiver_klass, R3_ARG1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1178 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1179 __ ld(ic_klass, CompiledICHolder::holder_klass_offset(), ic); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1180 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1181 if (TrapBasedICMissChecks) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1182 __ trap_ic_miss_check(receiver_klass, ic_klass); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1183 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1184 Label valid; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1185 __ cmpd(CCR0, receiver_klass, ic_klass); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1186 __ beq_predict_taken(CCR0, valid); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1187 // We have an unexpected klass, branch to ic_miss_stub. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1188 __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(), |
14445 | 1189 relocInfo::runtime_call_type); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1190 __ BIND(valid); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1191 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1192 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1193 // Argument is valid and klass is as expected, continue. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1194 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1195 // Extract method from inline cache, verified entry point needs it. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1196 __ ld(R19_method, CompiledICHolder::holder_method_offset(), ic); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1197 assert(R19_method == ic, "the inline cache register is dead here"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1198 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1199 __ ld(code, method_(code)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1200 __ cmpdi(CCR0, code, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1201 __ ld(ientry, method_(interpreter_entry)); // preloaded |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1202 __ beq_predict_taken(CCR0, call_interpreter); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1203 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1204 // Branch to ic_miss_stub. |
14445 | 1205 __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(), relocInfo::runtime_call_type); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1206 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1207 // entry: c2i |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1208 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1209 c2i_entry = gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, call_interpreter, ientry); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1210 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1211 return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1212 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1213 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1214 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1215 // An oop arg. Must pass a handle not the oop itself. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1216 static void object_move(MacroAssembler* masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1217 int frame_size_in_slots, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1218 OopMap* oop_map, int oop_handle_offset, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1219 bool is_receiver, int* receiver_offset, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1220 VMRegPair src, VMRegPair dst, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1221 Register r_caller_sp, Register r_temp_1, Register r_temp_2) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1222 assert(!is_receiver || (is_receiver && (*receiver_offset == -1)), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1223 "receiver has already been moved"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1224 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1225 // We must pass a handle. First figure out the location we use as a handle. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1226 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1227 if (src.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1228 // stack to stack or reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1229 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1230 const Register r_handle = dst.first()->is_stack() ? r_temp_1 : dst.first()->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1231 Label skip; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1232 const int oop_slot_in_callers_frame = reg2slot(src.first()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1233 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1234 guarantee(!is_receiver, "expecting receiver in register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1235 oop_map->set_oop(VMRegImpl::stack2reg(oop_slot_in_callers_frame + frame_size_in_slots)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1236 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1237 __ addi(r_handle, r_caller_sp, reg2offset(src.first())); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1238 __ ld( r_temp_2, reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1239 __ cmpdi(CCR0, r_temp_2, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1240 __ bne(CCR0, skip); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1241 // Use a NULL handle if oop is NULL. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1242 __ li(r_handle, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1243 __ bind(skip); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1244 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1245 if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1246 // stack to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1247 __ std(r_handle, reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1248 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1249 // stack to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1250 // Nothing to do, r_handle is already the dst register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1251 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1252 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1253 // reg to stack or reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1254 const Register r_oop = src.first()->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1255 const Register r_handle = dst.first()->is_stack() ? r_temp_1 : dst.first()->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1256 const int oop_slot = (r_oop->encoding()-R3_ARG1->encoding()) * VMRegImpl::slots_per_word |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1257 + oop_handle_offset; // in slots |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1258 const int oop_offset = oop_slot * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1259 Label skip; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1260 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1261 if (is_receiver) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1262 *receiver_offset = oop_offset; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1263 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1264 oop_map->set_oop(VMRegImpl::stack2reg(oop_slot)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1265 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1266 __ std( r_oop, oop_offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1267 __ addi(r_handle, R1_SP, oop_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1268 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1269 __ cmpdi(CCR0, r_oop, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1270 __ bne(CCR0, skip); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1271 // Use a NULL handle if oop is NULL. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1272 __ li(r_handle, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1273 __ bind(skip); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1274 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1275 if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1276 // reg to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1277 __ std(r_handle, reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1278 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1279 // reg to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1280 // Nothing to do, r_handle is already the dst register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1281 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1282 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1283 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1284 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1285 static void int_move(MacroAssembler*masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1286 VMRegPair src, VMRegPair dst, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1287 Register r_caller_sp, Register r_temp) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1288 assert(src.first()->is_valid() && src.second() == src.first()->next(), "incoming must be long-int"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1289 assert(dst.first()->is_valid() && dst.second() == dst.first()->next(), "outgoing must be long"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1290 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1291 if (src.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1292 if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1293 // stack to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1294 __ lwa(r_temp, reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1295 __ std(r_temp, reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1296 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1297 // stack to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1298 __ lwa(dst.first()->as_Register(), reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1299 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1300 } else if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1301 // reg to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1302 __ extsw(r_temp, src.first()->as_Register()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1303 __ std(r_temp, reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1304 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1305 // reg to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1306 __ extsw(dst.first()->as_Register(), src.first()->as_Register()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1307 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1308 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1309 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1310 static void long_move(MacroAssembler*masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1311 VMRegPair src, VMRegPair dst, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1312 Register r_caller_sp, Register r_temp) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1313 assert(src.first()->is_valid() && src.second() == src.first()->next(), "incoming must be long"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1314 assert(dst.first()->is_valid() && dst.second() == dst.first()->next(), "outgoing must be long"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1315 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1316 if (src.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1317 if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1318 // stack to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1319 __ ld( r_temp, reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1320 __ std(r_temp, reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1321 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1322 // stack to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1323 __ ld(dst.first()->as_Register(), reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1324 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1325 } else if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1326 // reg to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1327 __ std(src.first()->as_Register(), reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1328 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1329 // reg to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1330 if (dst.first()->as_Register() != src.first()->as_Register()) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1331 __ mr(dst.first()->as_Register(), src.first()->as_Register()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1332 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1333 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1334 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1335 static void float_move(MacroAssembler*masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1336 VMRegPair src, VMRegPair dst, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1337 Register r_caller_sp, Register r_temp) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1338 assert(src.first()->is_valid() && !src.second()->is_valid(), "incoming must be float"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1339 assert(dst.first()->is_valid() && !dst.second()->is_valid(), "outgoing must be float"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1340 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1341 if (src.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1342 if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1343 // stack to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1344 __ lwz(r_temp, reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1345 __ stw(r_temp, reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1346 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1347 // stack to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1348 __ lfs(dst.first()->as_FloatRegister(), reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1349 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1350 } else if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1351 // reg to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1352 __ stfs(src.first()->as_FloatRegister(), reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1353 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1354 // reg to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1355 if (dst.first()->as_FloatRegister() != src.first()->as_FloatRegister()) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1356 __ fmr(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1357 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1358 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1359 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1360 static void double_move(MacroAssembler*masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1361 VMRegPair src, VMRegPair dst, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1362 Register r_caller_sp, Register r_temp) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1363 assert(src.first()->is_valid() && src.second() == src.first()->next(), "incoming must be double"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1364 assert(dst.first()->is_valid() && dst.second() == dst.first()->next(), "outgoing must be double"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1365 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1366 if (src.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1367 if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1368 // stack to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1369 __ ld( r_temp, reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1370 __ std(r_temp, reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1371 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1372 // stack to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1373 __ lfd(dst.first()->as_FloatRegister(), reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1374 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1375 } else if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1376 // reg to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1377 __ stfd(src.first()->as_FloatRegister(), reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1378 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1379 // reg to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1380 if (dst.first()->as_FloatRegister() != src.first()->as_FloatRegister()) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1381 __ fmr(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1382 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1383 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1384 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1385 void SharedRuntime::save_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1386 switch (ret_type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1387 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1388 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1389 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1390 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1391 case T_INT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1392 __ stw (R3_RET, frame_slots*VMRegImpl::stack_slot_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1393 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1394 case T_ARRAY: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1395 case T_OBJECT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1396 case T_LONG: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1397 __ std (R3_RET, frame_slots*VMRegImpl::stack_slot_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1398 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1399 case T_FLOAT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1400 __ stfs(F1_RET, frame_slots*VMRegImpl::stack_slot_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1401 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1402 case T_DOUBLE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1403 __ stfd(F1_RET, frame_slots*VMRegImpl::stack_slot_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1404 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1405 case T_VOID: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1406 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1407 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1408 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1409 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1410 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1411 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1412 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1413 void SharedRuntime::restore_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1414 switch (ret_type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1415 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1416 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1417 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1418 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1419 case T_INT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1420 __ lwz(R3_RET, frame_slots*VMRegImpl::stack_slot_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1421 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1422 case T_ARRAY: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1423 case T_OBJECT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1424 case T_LONG: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1425 __ ld (R3_RET, frame_slots*VMRegImpl::stack_slot_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1426 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1427 case T_FLOAT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1428 __ lfs(F1_RET, frame_slots*VMRegImpl::stack_slot_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1429 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1430 case T_DOUBLE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1431 __ lfd(F1_RET, frame_slots*VMRegImpl::stack_slot_size, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1432 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1433 case T_VOID: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1434 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1435 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1436 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1437 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1438 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1439 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1440 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1441 static void save_or_restore_arguments(MacroAssembler* masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1442 const int stack_slots, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1443 const int total_in_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1444 const int arg_save_area, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1445 OopMap* map, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1446 VMRegPair* in_regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1447 BasicType* in_sig_bt) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1448 // If map is non-NULL then the code should store the values, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1449 // otherwise it should load them. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1450 int slot = arg_save_area; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1451 // Save down double word first. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1452 for (int i = 0; i < total_in_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1453 if (in_regs[i].first()->is_FloatRegister() && in_sig_bt[i] == T_DOUBLE) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1454 int offset = slot * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1455 slot += VMRegImpl::slots_per_word; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1456 assert(slot <= stack_slots, "overflow (after DOUBLE stack slot)"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1457 if (map != NULL) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1458 __ stfd(in_regs[i].first()->as_FloatRegister(), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1459 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1460 __ lfd(in_regs[i].first()->as_FloatRegister(), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1461 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1462 } else if (in_regs[i].first()->is_Register() && |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1463 (in_sig_bt[i] == T_LONG || in_sig_bt[i] == T_ARRAY)) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1464 int offset = slot * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1465 if (map != NULL) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1466 __ std(in_regs[i].first()->as_Register(), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1467 if (in_sig_bt[i] == T_ARRAY) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1468 map->set_oop(VMRegImpl::stack2reg(slot)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1469 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1470 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1471 __ ld(in_regs[i].first()->as_Register(), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1472 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1473 slot += VMRegImpl::slots_per_word; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1474 assert(slot <= stack_slots, "overflow (after LONG/ARRAY stack slot)"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1475 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1476 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1477 // Save or restore single word registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1478 for (int i = 0; i < total_in_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1479 // PPC64: pass ints as longs: must only deal with floats here. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1480 if (in_regs[i].first()->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1481 if (in_sig_bt[i] == T_FLOAT) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1482 int offset = slot * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1483 slot++; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1484 assert(slot <= stack_slots, "overflow (after FLOAT stack slot)"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1485 if (map != NULL) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1486 __ stfs(in_regs[i].first()->as_FloatRegister(), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1487 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1488 __ lfs(in_regs[i].first()->as_FloatRegister(), offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1489 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1490 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1491 } else if (in_regs[i].first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1492 if (in_sig_bt[i] == T_ARRAY && map != NULL) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1493 int offset_in_older_frame = in_regs[i].first()->reg2stack() + SharedRuntime::out_preserve_stack_slots(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1494 map->set_oop(VMRegImpl::stack2reg(offset_in_older_frame + stack_slots)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1495 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1496 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1497 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1498 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1499 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1500 // Check GC_locker::needs_gc and enter the runtime if it's true. This |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1501 // keeps a new JNI critical region from starting until a GC has been |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1502 // forced. Save down any oops in registers and describe them in an |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1503 // OopMap. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1504 static void check_needs_gc_for_critical_native(MacroAssembler* masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1505 const int stack_slots, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1506 const int total_in_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1507 const int arg_save_area, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1508 OopMapSet* oop_maps, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1509 VMRegPair* in_regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1510 BasicType* in_sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1511 Register tmp_reg ) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1512 __ block_comment("check GC_locker::needs_gc"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1513 Label cont; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1514 __ lbz(tmp_reg, (RegisterOrConstant)(intptr_t)GC_locker::needs_gc_address()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1515 __ cmplwi(CCR0, tmp_reg, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1516 __ beq(CCR0, cont); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1517 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1518 // Save down any values that are live in registers and call into the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1519 // runtime to halt for a GC. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1520 OopMap* map = new OopMap(stack_slots * 2, 0 /* arg_slots*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1521 save_or_restore_arguments(masm, stack_slots, total_in_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1522 arg_save_area, map, in_regs, in_sig_bt); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1523 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1524 __ mr(R3_ARG1, R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1525 __ set_last_Java_frame(R1_SP, noreg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1526 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1527 __ block_comment("block_for_jni_critical"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1528 address entry_point = CAST_FROM_FN_PTR(address, SharedRuntime::block_for_jni_critical); |
14684 | 1529 #if defined(ABI_ELFv2) |
1530 __ call_c(entry_point, relocInfo::runtime_call_type); | |
1531 #else | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1532 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, entry_point), relocInfo::runtime_call_type); |
14684 | 1533 #endif |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1534 address start = __ pc() - __ offset(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1535 calls_return_pc = __ last_calls_return_pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1536 oop_maps->add_gc_map(calls_return_pc - start, map); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1537 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1538 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1539 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1540 // Reload all the register arguments. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1541 save_or_restore_arguments(masm, stack_slots, total_in_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1542 arg_save_area, NULL, in_regs, in_sig_bt); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1543 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1544 __ BIND(cont); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1545 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1546 #ifdef ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1547 if (StressCriticalJNINatives) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1548 // Stress register saving. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1549 OopMap* map = new OopMap(stack_slots * 2, 0 /* arg_slots*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1550 save_or_restore_arguments(masm, stack_slots, total_in_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1551 arg_save_area, map, in_regs, in_sig_bt); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1552 // Destroy argument registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1553 for (int i = 0; i < total_in_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1554 if (in_regs[i].first()->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1555 const Register reg = in_regs[i].first()->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1556 __ neg(reg, reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1557 } else if (in_regs[i].first()->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1558 __ fneg(in_regs[i].first()->as_FloatRegister(), in_regs[i].first()->as_FloatRegister()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1559 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1560 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1561 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1562 save_or_restore_arguments(masm, stack_slots, total_in_args, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1563 arg_save_area, NULL, in_regs, in_sig_bt); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1564 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1565 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1566 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1567 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1568 static void move_ptr(MacroAssembler* masm, VMRegPair src, VMRegPair dst, Register r_caller_sp, Register r_temp) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1569 if (src.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1570 if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1571 // stack to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1572 __ ld(r_temp, reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1573 __ std(r_temp, reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1574 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1575 // stack to reg |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1576 __ ld(dst.first()->as_Register(), reg2offset(src.first()), r_caller_sp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1577 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1578 } else if (dst.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1579 // reg to stack |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1580 __ std(src.first()->as_Register(), reg2offset(dst.first()), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1581 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1582 if (dst.first() != src.first()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1583 __ mr(dst.first()->as_Register(), src.first()->as_Register()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1584 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1585 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1586 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1587 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1588 // Unpack an array argument into a pointer to the body and the length |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1589 // if the array is non-null, otherwise pass 0 for both. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1590 static void unpack_array_argument(MacroAssembler* masm, VMRegPair reg, BasicType in_elem_type, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1591 VMRegPair body_arg, VMRegPair length_arg, Register r_caller_sp, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1592 Register tmp_reg, Register tmp2_reg) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1593 assert(!body_arg.first()->is_Register() || body_arg.first()->as_Register() != tmp_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1594 "possible collision"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1595 assert(!length_arg.first()->is_Register() || length_arg.first()->as_Register() != tmp_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1596 "possible collision"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1597 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1598 // Pass the length, ptr pair. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1599 Label set_out_args; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1600 VMRegPair tmp, tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1601 tmp.set_ptr(tmp_reg->as_VMReg()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1602 tmp2.set_ptr(tmp2_reg->as_VMReg()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1603 if (reg.first()->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1604 // Load the arg up from the stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1605 move_ptr(masm, reg, tmp, r_caller_sp, /*unused*/ R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1606 reg = tmp; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1607 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1608 __ li(tmp2_reg, 0); // Pass zeros if Array=null. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1609 if (tmp_reg != reg.first()->as_Register()) __ li(tmp_reg, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1610 __ cmpdi(CCR0, reg.first()->as_Register(), 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1611 __ beq(CCR0, set_out_args); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1612 __ lwa(tmp2_reg, arrayOopDesc::length_offset_in_bytes(), reg.first()->as_Register()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1613 __ addi(tmp_reg, reg.first()->as_Register(), arrayOopDesc::base_offset_in_bytes(in_elem_type)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1614 __ bind(set_out_args); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1615 move_ptr(masm, tmp, body_arg, r_caller_sp, /*unused*/ R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1616 move_ptr(masm, tmp2, length_arg, r_caller_sp, /*unused*/ R0); // Same as move32_64 on PPC64. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1617 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1618 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1619 static void verify_oop_args(MacroAssembler* masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1620 methodHandle method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1621 const BasicType* sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1622 const VMRegPair* regs) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1623 Register temp_reg = R19_method; // not part of any compiled calling seq |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1624 if (VerifyOops) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1625 for (int i = 0; i < method->size_of_parameters(); i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1626 if (sig_bt[i] == T_OBJECT || |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1627 sig_bt[i] == T_ARRAY) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1628 VMReg r = regs[i].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1629 assert(r->is_valid(), "bad oop arg"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1630 if (r->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1631 __ ld(temp_reg, reg2offset(r), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1632 __ verify_oop(temp_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1633 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1634 __ verify_oop(r->as_Register()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1635 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1636 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1637 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1638 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1639 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1640 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1641 static void gen_special_dispatch(MacroAssembler* masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1642 methodHandle method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1643 const BasicType* sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1644 const VMRegPair* regs) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1645 verify_oop_args(masm, method, sig_bt, regs); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1646 vmIntrinsics::ID iid = method->intrinsic_id(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1647 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1648 // Now write the args into the outgoing interpreter space |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1649 bool has_receiver = false; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1650 Register receiver_reg = noreg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1651 int member_arg_pos = -1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1652 Register member_reg = noreg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1653 int ref_kind = MethodHandles::signature_polymorphic_intrinsic_ref_kind(iid); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1654 if (ref_kind != 0) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1655 member_arg_pos = method->size_of_parameters() - 1; // trailing MemberName argument |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1656 member_reg = R19_method; // known to be free at this point |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1657 has_receiver = MethodHandles::ref_kind_has_receiver(ref_kind); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1658 } else if (iid == vmIntrinsics::_invokeBasic) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1659 has_receiver = true; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1660 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1661 fatal(err_msg_res("unexpected intrinsic id %d", iid)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1662 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1663 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1664 if (member_reg != noreg) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1665 // Load the member_arg into register, if necessary. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1666 SharedRuntime::check_member_name_argument_is_last_argument(method, sig_bt, regs); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1667 VMReg r = regs[member_arg_pos].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1668 if (r->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1669 __ ld(member_reg, reg2offset(r), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1670 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1671 // no data motion is needed |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1672 member_reg = r->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1673 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1674 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1675 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1676 if (has_receiver) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1677 // Make sure the receiver is loaded into a register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1678 assert(method->size_of_parameters() > 0, "oob"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1679 assert(sig_bt[0] == T_OBJECT, "receiver argument must be an object"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1680 VMReg r = regs[0].first(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1681 assert(r->is_valid(), "bad receiver arg"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1682 if (r->is_stack()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1683 // Porting note: This assumes that compiled calling conventions always |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1684 // pass the receiver oop in a register. If this is not true on some |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1685 // platform, pick a temp and load the receiver from stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1686 fatal("receiver always in a register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1687 receiver_reg = R11_scratch1; // TODO (hs24): is R11_scratch1 really free at this point? |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1688 __ ld(receiver_reg, reg2offset(r), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1689 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1690 // no data motion is needed |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1691 receiver_reg = r->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1692 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1693 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1694 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1695 // Figure out which address we are really jumping to: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1696 MethodHandles::generate_method_handle_dispatch(masm, iid, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1697 receiver_reg, member_reg, /*for_compiler_entry:*/ true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1698 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1699 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1700 #endif // COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1701 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1702 // --------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1703 // Generate a native wrapper for a given method. The method takes arguments |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1704 // in the Java compiled code convention, marshals them to the native |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1705 // convention (handlizes oops, etc), transitions to native, makes the call, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1706 // returns to java state (possibly blocking), unhandlizes any result and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1707 // returns. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1708 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1709 // Critical native functions are a shorthand for the use of |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1710 // GetPrimtiveArrayCritical and disallow the use of any other JNI |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1711 // functions. The wrapper is expected to unpack the arguments before |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1712 // passing them to the callee and perform checks before and after the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1713 // native call to ensure that they GC_locker |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1714 // lock_critical/unlock_critical semantics are followed. Some other |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1715 // parts of JNI setup are skipped like the tear down of the JNI handle |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1716 // block and the check for pending exceptions it's impossible for them |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1717 // to be thrown. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1718 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1719 // They are roughly structured like this: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1720 // if (GC_locker::needs_gc()) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1721 // SharedRuntime::block_for_jni_critical(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1722 // tranistion to thread_in_native |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1723 // unpack arrray arguments and call native entry point |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1724 // check for safepoint in progress |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1725 // check if any thread suspend flags are set |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1726 // call into JVM and possible unlock the JNI critical |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1727 // if a GC was suppressed while in the critical native. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1728 // transition back to thread_in_Java |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1729 // return to caller |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1730 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1731 nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1732 methodHandle method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1733 int compile_id, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1734 BasicType *in_sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1735 VMRegPair *in_regs, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1736 BasicType ret_type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1737 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1738 if (method->is_method_handle_intrinsic()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1739 vmIntrinsics::ID iid = method->intrinsic_id(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1740 intptr_t start = (intptr_t)__ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1741 int vep_offset = ((intptr_t)__ pc()) - start; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1742 gen_special_dispatch(masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1743 method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1744 in_sig_bt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1745 in_regs); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1746 int frame_complete = ((intptr_t)__ pc()) - start; // not complete, period |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1747 __ flush(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1748 int stack_slots = SharedRuntime::out_preserve_stack_slots(); // no out slots at all, actually |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1749 return nmethod::new_native_nmethod(method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1750 compile_id, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1751 masm->code(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1752 vep_offset, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1753 frame_complete, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1754 stack_slots / VMRegImpl::slots_per_word, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1755 in_ByteSize(-1), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1756 in_ByteSize(-1), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1757 (OopMapSet*)NULL); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1758 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1759 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1760 bool is_critical_native = true; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1761 address native_func = method->critical_native_function(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1762 if (native_func == NULL) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1763 native_func = method->native_function(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1764 is_critical_native = false; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1765 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1766 assert(native_func != NULL, "must have function"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1767 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1768 // First, create signature for outgoing C call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1769 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1770 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1771 int total_in_args = method->size_of_parameters(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1772 // We have received a description of where all the java args are located |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1773 // on entry to the wrapper. We need to convert these args to where |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1774 // the jni function will expect them. To figure out where they go |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1775 // we convert the java signature to a C signature by inserting |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1776 // the hidden arguments as arg[0] and possibly arg[1] (static method) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1777 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1778 // Additionally, on ppc64 we must convert integers to longs in the C |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1779 // signature. We do this in advance in order to have no trouble with |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1780 // indexes into the bt-arrays. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1781 // So convert the signature and registers now, and adjust the total number |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1782 // of in-arguments accordingly. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1783 int i2l_argcnt = convert_ints_to_longints_argcnt(total_in_args, in_sig_bt); // PPC64: pass ints as longs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1784 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1785 // Calculate the total number of C arguments and create arrays for the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1786 // signature and the outgoing registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1787 // On ppc64, we have two arrays for the outgoing registers, because |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1788 // some floating-point arguments must be passed in registers _and_ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1789 // in stack locations. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1790 bool method_is_static = method->is_static(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1791 int total_c_args = i2l_argcnt; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1792 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1793 if (!is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1794 int n_hidden_args = method_is_static ? 2 : 1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1795 total_c_args += n_hidden_args; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1796 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1797 // No JNIEnv*, no this*, but unpacked arrays (base+length). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1798 for (int i = 0; i < total_in_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1799 if (in_sig_bt[i] == T_ARRAY) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1800 total_c_args += 2; // PPC64: T_LONG, T_INT, T_ADDRESS (see convert_ints_to_longints and c_calling_convention) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1801 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1802 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1803 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1804 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1805 BasicType *out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_c_args); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1806 VMRegPair *out_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_c_args); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1807 VMRegPair *out_regs2 = NEW_RESOURCE_ARRAY(VMRegPair, total_c_args); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1808 BasicType* in_elem_bt = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1809 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1810 // Create the signature for the C call: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1811 // 1) add the JNIEnv* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1812 // 2) add the class if the method is static |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1813 // 3) copy the rest of the incoming signature (shifted by the number of |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1814 // hidden arguments). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1815 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1816 int argc = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1817 if (!is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1818 convert_ints_to_longints(i2l_argcnt, total_in_args, in_sig_bt, in_regs); // PPC64: pass ints as longs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1819 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1820 out_sig_bt[argc++] = T_ADDRESS; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1821 if (method->is_static()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1822 out_sig_bt[argc++] = T_OBJECT; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1823 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1824 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1825 for (int i = 0; i < total_in_args ; i++ ) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1826 out_sig_bt[argc++] = in_sig_bt[i]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1827 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1828 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1829 Thread* THREAD = Thread::current(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1830 in_elem_bt = NEW_RESOURCE_ARRAY(BasicType, i2l_argcnt); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1831 SignatureStream ss(method->signature()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1832 int o = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1833 for (int i = 0; i < total_in_args ; i++, o++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1834 if (in_sig_bt[i] == T_ARRAY) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1835 // Arrays are passed as int, elem* pair |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1836 Symbol* atype = ss.as_symbol(CHECK_NULL); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1837 const char* at = atype->as_C_string(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1838 if (strlen(at) == 2) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1839 assert(at[0] == '[', "must be"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1840 switch (at[1]) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1841 case 'B': in_elem_bt[o] = T_BYTE; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1842 case 'C': in_elem_bt[o] = T_CHAR; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1843 case 'D': in_elem_bt[o] = T_DOUBLE; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1844 case 'F': in_elem_bt[o] = T_FLOAT; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1845 case 'I': in_elem_bt[o] = T_INT; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1846 case 'J': in_elem_bt[o] = T_LONG; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1847 case 'S': in_elem_bt[o] = T_SHORT; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1848 case 'Z': in_elem_bt[o] = T_BOOLEAN; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1849 default: ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1850 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1851 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1852 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1853 in_elem_bt[o] = T_VOID; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1854 switch(in_sig_bt[i]) { // PPC64: pass ints as longs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1855 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1856 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1857 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1858 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1859 case T_INT: in_elem_bt[++o] = T_VOID; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1860 default: break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1861 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1862 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1863 if (in_sig_bt[i] != T_VOID) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1864 assert(in_sig_bt[i] == ss.type(), "must match"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1865 ss.next(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1866 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1867 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1868 assert(i2l_argcnt==o, "must match"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1869 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1870 convert_ints_to_longints(i2l_argcnt, total_in_args, in_sig_bt, in_regs); // PPC64: pass ints as longs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1871 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1872 for (int i = 0; i < total_in_args ; i++ ) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1873 if (in_sig_bt[i] == T_ARRAY) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1874 // Arrays are passed as int, elem* pair. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1875 out_sig_bt[argc++] = T_LONG; // PPC64: pass ints as longs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1876 out_sig_bt[argc++] = T_INT; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1877 out_sig_bt[argc++] = T_ADDRESS; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1878 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1879 out_sig_bt[argc++] = in_sig_bt[i]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1880 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1881 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1882 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1883 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1884 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1885 // Compute the wrapper's frame size. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1886 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1887 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1888 // Now figure out where the args must be stored and how much stack space |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1889 // they require. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1890 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1891 // Compute framesize for the wrapper. We need to handlize all oops in |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1892 // incoming registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1893 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1894 // Calculate the total number of stack slots we will need: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1895 // 1) abi requirements |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1896 // 2) outgoing arguments |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1897 // 3) space for inbound oop handle area |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1898 // 4) space for handlizing a klass if static method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1899 // 5) space for a lock if synchronized method |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1900 // 6) workspace for saving return values, int <-> float reg moves, etc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1901 // 7) alignment |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1902 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1903 // Layout of the native wrapper frame: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1904 // (stack grows upwards, memory grows downwards) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1905 // |
14684 | 1906 // NW [ABI_REG_ARGS] <-- 1) R1_SP |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1907 // [outgoing arguments] <-- 2) R1_SP + out_arg_slot_offset |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1908 // [oopHandle area] <-- 3) R1_SP + oop_handle_offset (save area for critical natives) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1909 // klass <-- 4) R1_SP + klass_offset |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1910 // lock <-- 5) R1_SP + lock_offset |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1911 // [workspace] <-- 6) R1_SP + workspace_offset |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1912 // [alignment] (optional) <-- 7) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1913 // caller [JIT_TOP_ABI_48] <-- r_callers_sp |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1914 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1915 // - *_slot_offset Indicates offset from SP in number of stack slots. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1916 // - *_offset Indicates offset from SP in bytes. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1917 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1918 int stack_slots = c_calling_convention(out_sig_bt, out_regs, out_regs2, total_c_args) // 1+2) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1919 + SharedRuntime::out_preserve_stack_slots(); // See c_calling_convention. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1920 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1921 // Now the space for the inbound oop handle area. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1922 int total_save_slots = num_java_iarg_registers * VMRegImpl::slots_per_word; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1923 if (is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1924 // Critical natives may have to call out so they need a save area |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1925 // for register arguments. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1926 int double_slots = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1927 int single_slots = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1928 for (int i = 0; i < total_in_args; i++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1929 if (in_regs[i].first()->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1930 const Register reg = in_regs[i].first()->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1931 switch (in_sig_bt[i]) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1932 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1933 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1934 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1935 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1936 case T_INT: /*single_slots++;*/ break; // PPC64: pass ints as longs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1937 case T_ARRAY: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1938 case T_LONG: double_slots++; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1939 default: ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1940 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1941 } else if (in_regs[i].first()->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1942 switch (in_sig_bt[i]) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1943 case T_FLOAT: single_slots++; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1944 case T_DOUBLE: double_slots++; break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1945 default: ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1946 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1947 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1948 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1949 total_save_slots = double_slots * 2 + round_to(single_slots, 2); // round to even |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1950 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1951 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1952 int oop_handle_slot_offset = stack_slots; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1953 stack_slots += total_save_slots; // 3) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1954 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1955 int klass_slot_offset = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1956 int klass_offset = -1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1957 if (method_is_static && !is_critical_native) { // 4) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1958 klass_slot_offset = stack_slots; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1959 klass_offset = klass_slot_offset * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1960 stack_slots += VMRegImpl::slots_per_word; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1961 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1962 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1963 int lock_slot_offset = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1964 int lock_offset = -1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1965 if (method->is_synchronized()) { // 5) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1966 lock_slot_offset = stack_slots; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1967 lock_offset = lock_slot_offset * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1968 stack_slots += VMRegImpl::slots_per_word; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1969 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1970 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1971 int workspace_slot_offset = stack_slots; // 6) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1972 stack_slots += 2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1973 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1974 // Now compute actual number of stack words we need. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1975 // Rounding to make stack properly aligned. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1976 stack_slots = round_to(stack_slots, // 7) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1977 frame::alignment_in_bytes / VMRegImpl::stack_slot_size); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1978 int frame_size_in_bytes = stack_slots * VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1979 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1980 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1981 // Now we can start generating code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1982 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1983 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1984 intptr_t start_pc = (intptr_t)__ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1985 intptr_t vep_start_pc; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1986 intptr_t frame_done_pc; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1987 intptr_t oopmap_pc; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1988 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1989 Label ic_miss; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1990 Label handle_pending_exception; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1991 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1992 Register r_callers_sp = R21; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1993 Register r_temp_1 = R22; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1994 Register r_temp_2 = R23; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1995 Register r_temp_3 = R24; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1996 Register r_temp_4 = R25; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1997 Register r_temp_5 = R26; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1998 Register r_temp_6 = R27; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1999 Register r_return_pc = R28; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2000 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2001 Register r_carg1_jnienv = noreg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2002 Register r_carg2_classorobject = noreg; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2003 if (!is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2004 r_carg1_jnienv = out_regs[0].first()->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2005 r_carg2_classorobject = out_regs[1].first()->as_Register(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2006 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2007 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2008 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2009 // Generate the Unverified Entry Point (UEP). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2010 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2011 assert(start_pc == (intptr_t)__ pc(), "uep must be at start"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2012 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2013 // Check ic: object class == cached class? |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2014 if (!method_is_static) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2015 Register ic = as_Register(Matcher::inline_cache_reg_encode()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2016 Register receiver_klass = r_temp_1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2017 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2018 __ cmpdi(CCR0, R3_ARG1, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2019 __ beq(CCR0, ic_miss); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2020 __ verify_oop(R3_ARG1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2021 __ load_klass(receiver_klass, R3_ARG1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2022 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2023 __ cmpd(CCR0, receiver_klass, ic); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2024 __ bne(CCR0, ic_miss); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2025 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2026 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2027 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2028 // Generate the Verified Entry Point (VEP). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2029 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2030 vep_start_pc = (intptr_t)__ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2031 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2032 __ save_LR_CR(r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2033 __ generate_stack_overflow_check(frame_size_in_bytes); // Check before creating frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2034 __ mr(r_callers_sp, R1_SP); // Remember frame pointer. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2035 __ push_frame(frame_size_in_bytes, r_temp_1); // Push the c2n adapter's frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2036 frame_done_pc = (intptr_t)__ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2037 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2038 // Native nmethod wrappers never take possesion of the oop arguments. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2039 // So the caller will gc the arguments. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2040 // The only thing we need an oopMap for is if the call is static. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2041 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2042 // An OopMap for lock (and class if static), and one for the VM call itself. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2043 OopMapSet *oop_maps = new OopMapSet(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2044 OopMap *oop_map = new OopMap(stack_slots * 2, 0 /* arg_slots*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2045 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2046 if (is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2047 check_needs_gc_for_critical_native(masm, stack_slots, total_in_args, oop_handle_slot_offset, oop_maps, in_regs, in_sig_bt, r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2048 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2049 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2050 // Move arguments from register/stack to register/stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2051 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2052 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2053 // We immediately shuffle the arguments so that for any vm call we have |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2054 // to make from here on out (sync slow path, jvmti, etc.) we will have |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2055 // captured the oops from our caller and have a valid oopMap for them. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2056 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2057 // Natives require 1 or 2 extra arguments over the normal ones: the JNIEnv* |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2058 // (derived from JavaThread* which is in R16_thread) and, if static, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2059 // the class mirror instead of a receiver. This pretty much guarantees that |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2060 // register layout will not match. We ignore these extra arguments during |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2061 // the shuffle. The shuffle is described by the two calling convention |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2062 // vectors we have in our possession. We simply walk the java vector to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2063 // get the source locations and the c vector to get the destinations. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2064 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2065 // Record sp-based slot for receiver on stack for non-static methods. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2066 int receiver_offset = -1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2067 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2068 // We move the arguments backward because the floating point registers |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2069 // destination will always be to a register with a greater or equal |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2070 // register number or the stack. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2071 // in is the index of the incoming Java arguments |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2072 // out is the index of the outgoing C arguments |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2073 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2074 #ifdef ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2075 bool reg_destroyed[RegisterImpl::number_of_registers]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2076 bool freg_destroyed[FloatRegisterImpl::number_of_registers]; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2077 for (int r = 0 ; r < RegisterImpl::number_of_registers ; r++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2078 reg_destroyed[r] = false; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2079 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2080 for (int f = 0 ; f < FloatRegisterImpl::number_of_registers ; f++) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2081 freg_destroyed[f] = false; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2082 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2083 #endif // ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2084 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2085 for (int in = total_in_args - 1, out = total_c_args - 1; in >= 0 ; in--, out--) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2086 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2087 #ifdef ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2088 if (in_regs[in].first()->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2089 assert(!reg_destroyed[in_regs[in].first()->as_Register()->encoding()], "ack!"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2090 } else if (in_regs[in].first()->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2091 assert(!freg_destroyed[in_regs[in].first()->as_FloatRegister()->encoding()], "ack!"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2092 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2093 if (out_regs[out].first()->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2094 reg_destroyed[out_regs[out].first()->as_Register()->encoding()] = true; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2095 } else if (out_regs[out].first()->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2096 freg_destroyed[out_regs[out].first()->as_FloatRegister()->encoding()] = true; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2097 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2098 if (out_regs2[out].first()->is_Register()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2099 reg_destroyed[out_regs2[out].first()->as_Register()->encoding()] = true; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2100 } else if (out_regs2[out].first()->is_FloatRegister()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2101 freg_destroyed[out_regs2[out].first()->as_FloatRegister()->encoding()] = true; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2102 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2103 #endif // ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2104 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2105 switch (in_sig_bt[in]) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2106 case T_BOOLEAN: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2107 case T_CHAR: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2108 case T_BYTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2109 case T_SHORT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2110 case T_INT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2111 guarantee(in > 0 && in_sig_bt[in-1] == T_LONG, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2112 "expecting type (T_LONG,bt) for bt in {T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2113 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2114 case T_LONG: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2115 if (in_sig_bt[in+1] == T_VOID) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2116 long_move(masm, in_regs[in], out_regs[out], r_callers_sp, r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2117 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2118 guarantee(in_sig_bt[in+1] == T_BOOLEAN || in_sig_bt[in+1] == T_CHAR || |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2119 in_sig_bt[in+1] == T_BYTE || in_sig_bt[in+1] == T_SHORT || |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2120 in_sig_bt[in+1] == T_INT, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2121 "expecting type (T_LONG,bt) for bt in {T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2122 int_move(masm, in_regs[in], out_regs[out], r_callers_sp, r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2123 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2124 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2125 case T_ARRAY: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2126 if (is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2127 int body_arg = out; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2128 out -= 2; // Point to length arg. PPC64: pass ints as longs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2129 unpack_array_argument(masm, in_regs[in], in_elem_bt[in], out_regs[body_arg], out_regs[out], |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2130 r_callers_sp, r_temp_1, r_temp_2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2131 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2132 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2133 case T_OBJECT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2134 assert(!is_critical_native, "no oop arguments"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2135 object_move(masm, stack_slots, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2136 oop_map, oop_handle_slot_offset, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2137 ((in == 0) && (!method_is_static)), &receiver_offset, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2138 in_regs[in], out_regs[out], |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2139 r_callers_sp, r_temp_1, r_temp_2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2140 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2141 case T_VOID: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2142 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2143 case T_FLOAT: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2144 float_move(masm, in_regs[in], out_regs[out], r_callers_sp, r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2145 if (out_regs2[out].first()->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2146 float_move(masm, in_regs[in], out_regs2[out], r_callers_sp, r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2147 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2148 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2149 case T_DOUBLE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2150 double_move(masm, in_regs[in], out_regs[out], r_callers_sp, r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2151 if (out_regs2[out].first()->is_valid()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2152 double_move(masm, in_regs[in], out_regs2[out], r_callers_sp, r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2153 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2154 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2155 case T_ADDRESS: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2156 fatal("found type (T_ADDRESS) in java args"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2157 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2158 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2159 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2160 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2161 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2162 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2163 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2164 // Pre-load a static method's oop into ARG2. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2165 // Used both by locking code and the normal JNI call code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2166 if (method_is_static && !is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2167 __ set_oop_constant(JNIHandles::make_local(method->method_holder()->java_mirror()), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2168 r_carg2_classorobject); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2169 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2170 // Now handlize the static class mirror in carg2. It's known not-null. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2171 __ std(r_carg2_classorobject, klass_offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2172 oop_map->set_oop(VMRegImpl::stack2reg(klass_slot_offset)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2173 __ addi(r_carg2_classorobject, R1_SP, klass_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2174 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2175 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2176 // Get JNIEnv* which is first argument to native. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2177 if (!is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2178 __ addi(r_carg1_jnienv, R16_thread, in_bytes(JavaThread::jni_environment_offset())); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2179 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2180 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2181 // NOTE: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2182 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2183 // We have all of the arguments setup at this point. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2184 // We MUST NOT touch any outgoing regs from this point on. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2185 // So if we must call out we must push a new frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2186 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2187 // Get current pc for oopmap, and load it patchable relative to global toc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2188 oopmap_pc = (intptr_t) __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2189 __ calculate_address_from_global_toc(r_return_pc, (address)oopmap_pc, true, true, true, true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2190 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2191 // We use the same pc/oopMap repeatedly when we call out. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2192 oop_maps->add_gc_map(oopmap_pc - start_pc, oop_map); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2193 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2194 // r_return_pc now has the pc loaded that we will use when we finally call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2195 // to native. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2196 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2197 // Make sure that thread is non-volatile; it crosses a bunch of VM calls below. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2198 assert(R16_thread->is_nonvolatile(), "thread must be in non-volatile register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2199 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2200 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2201 # if 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2202 // DTrace method entry |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2203 # endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2204 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2205 // Lock a synchronized method. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2206 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2207 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2208 if (method->is_synchronized()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2209 assert(!is_critical_native, "unhandled"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2210 ConditionRegister r_flag = CCR1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2211 Register r_oop = r_temp_4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2212 const Register r_box = r_temp_5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2213 Label done, locked; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2214 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2215 // Load the oop for the object or class. r_carg2_classorobject contains |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2216 // either the handlized oop from the incoming arguments or the handlized |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2217 // class mirror (if the method is static). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2218 __ ld(r_oop, 0, r_carg2_classorobject); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2219 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2220 // Get the lock box slot's address. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2221 __ addi(r_box, R1_SP, lock_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2222 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2223 # ifdef ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2224 if (UseBiasedLocking) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2225 // Making the box point to itself will make it clear it went unused |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2226 // but also be obviously invalid. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2227 __ std(r_box, 0, r_box); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2228 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2229 # endif // ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2230 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2231 // Try fastpath for locking. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2232 // fast_lock kills r_temp_1, r_temp_2, r_temp_3. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2233 __ compiler_fast_lock_object(r_flag, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2234 __ beq(r_flag, locked); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2235 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2236 // None of the above fast optimizations worked so we have to get into the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2237 // slow case of monitor enter. Inline a special case of call_VM that |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2238 // disallows any pending_exception. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2239 |
14684 | 2240 // Save argument registers and leave room for C-compatible ABI_REG_ARGS. |
2241 int frame_size = frame::abi_reg_args_size + | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2242 round_to(total_c_args * wordSize, frame::alignment_in_bytes); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2243 __ mr(R11_scratch1, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2244 RegisterSaver::push_frame_and_save_argument_registers(masm, R12_scratch2, frame_size, total_c_args, out_regs, out_regs2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2245 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2246 // Do the call. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2247 __ set_last_Java_frame(R11_scratch1, r_return_pc); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2248 assert(r_return_pc->is_nonvolatile(), "expecting return pc to be in non-volatile register"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2249 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_locking_C), r_oop, r_box, R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2250 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2251 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2252 RegisterSaver::restore_argument_registers_and_pop_frame(masm, frame_size, total_c_args, out_regs, out_regs2); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2253 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2254 __ asm_assert_mem8_is_zero(thread_(pending_exception), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2255 "no pending exception allowed on exit from SharedRuntime::complete_monitor_locking_C", 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2256 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2257 __ bind(locked); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2258 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2259 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2260 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2261 // Publish thread state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2262 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2263 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2264 // Use that pc we placed in r_return_pc a while back as the current frame anchor. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2265 __ set_last_Java_frame(R1_SP, r_return_pc); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2266 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2267 // Transition from _thread_in_Java to _thread_in_native. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2268 __ li(R0, _thread_in_native); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2269 __ release(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2270 // TODO: PPC port assert(4 == JavaThread::sz_thread_state(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2271 __ stw(R0, thread_(thread_state)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2272 if (UseMembar) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2273 __ fence(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2274 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2275 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2276 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2277 // The JNI call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2278 // -------------------------------------------------------------------------- |
14684 | 2279 #if defined(ABI_ELFv2) |
2280 __ call_c(native_func, relocInfo::runtime_call_type); | |
2281 #else | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2282 FunctionDescriptor* fd_native_method = (FunctionDescriptor*) native_func; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2283 __ call_c(fd_native_method, relocInfo::runtime_call_type); |
14684 | 2284 #endif |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2285 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2286 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2287 // Now, we are back from the native code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2288 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2289 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2290 // Unpack the native result. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2291 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2292 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2293 // For int-types, we do any needed sign-extension required. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2294 // Care must be taken that the return values (R3_RET and F1_RET) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2295 // will survive any VM calls for blocking or unlocking. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2296 // An OOP result (handle) is done specially in the slow-path code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2297 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2298 switch (ret_type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2299 case T_VOID: break; // Nothing to do! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2300 case T_FLOAT: break; // Got it where we want it (unless slow-path). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2301 case T_DOUBLE: break; // Got it where we want it (unless slow-path). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2302 case T_LONG: break; // Got it where we want it (unless slow-path). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2303 case T_OBJECT: break; // Really a handle. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2304 // Cannot de-handlize until after reclaiming jvm_lock. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2305 case T_ARRAY: break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2306 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2307 case T_BOOLEAN: { // 0 -> false(0); !0 -> true(1) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2308 Label skip_modify; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2309 __ cmpwi(CCR0, R3_RET, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2310 __ beq(CCR0, skip_modify); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2311 __ li(R3_RET, 1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2312 __ bind(skip_modify); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2313 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2314 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2315 case T_BYTE: { // sign extension |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2316 __ extsb(R3_RET, R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2317 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2318 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2319 case T_CHAR: { // unsigned result |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2320 __ andi(R3_RET, R3_RET, 0xffff); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2321 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2322 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2323 case T_SHORT: { // sign extension |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2324 __ extsh(R3_RET, R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2325 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2326 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2327 case T_INT: // nothing to do |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2328 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2329 default: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2330 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2331 break; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2332 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2333 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2334 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2335 // Publish thread state |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2336 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2337 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2338 // Switch thread to "native transition" state before reading the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2339 // synchronization state. This additional state is necessary because reading |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2340 // and testing the synchronization state is not atomic w.r.t. GC, as this |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2341 // scenario demonstrates: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2342 // - Java thread A, in _thread_in_native state, loads _not_synchronized |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2343 // and is preempted. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2344 // - VM thread changes sync state to synchronizing and suspends threads |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2345 // for GC. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2346 // - Thread A is resumed to finish this native method, but doesn't block |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2347 // here since it didn't see any synchronization in progress, and escapes. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2348 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2349 // Transition from _thread_in_native to _thread_in_native_trans. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2350 __ li(R0, _thread_in_native_trans); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2351 __ release(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2352 // TODO: PPC port assert(4 == JavaThread::sz_thread_state(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2353 __ stw(R0, thread_(thread_state)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2354 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2355 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2356 // Must we block? |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2357 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2358 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2359 // Block, if necessary, before resuming in _thread_in_Java state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2360 // In order for GC to work, don't clear the last_Java_sp until after blocking. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2361 Label after_transition; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2362 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2363 Label no_block, sync; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2364 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2365 if (os::is_MP()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2366 if (UseMembar) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2367 // Force this write out before the read below. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2368 __ fence(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2369 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2370 // Write serialization page so VM thread can do a pseudo remote membar. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2371 // We use the current thread pointer to calculate a thread specific |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2372 // offset to write to within the page. This minimizes bus traffic |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2373 // due to cache line collision. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2374 __ serialize_memory(R16_thread, r_temp_4, r_temp_5); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2375 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2376 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2377 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2378 Register sync_state_addr = r_temp_4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2379 Register sync_state = r_temp_5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2380 Register suspend_flags = r_temp_6; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2381 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2382 __ load_const(sync_state_addr, SafepointSynchronize::address_of_state(), /*temp*/ sync_state); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2383 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2384 // TODO: PPC port assert(4 == SafepointSynchronize::sz_state(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2385 __ lwz(sync_state, 0, sync_state_addr); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2386 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2387 // TODO: PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2388 __ lwz(suspend_flags, thread_(suspend_flags)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2389 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2390 __ acquire(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2391 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2392 Label do_safepoint; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2393 // No synchronization in progress nor yet synchronized. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2394 __ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2395 // Not suspended. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2396 __ cmpwi(CCR1, suspend_flags, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2397 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2398 __ bne(CCR0, sync); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2399 __ beq(CCR1, no_block); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2400 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2401 // Block. Save any potential method result value before the operation and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2402 // use a leaf call to leave the last_Java_frame setup undisturbed. Doing this |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2403 // lets us share the oopMap we used when we went native rather than create |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2404 // a distinct one for this pc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2405 __ bind(sync); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2406 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2407 address entry_point = is_critical_native |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2408 ? CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans_and_transition) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2409 : CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2410 save_native_result(masm, ret_type, workspace_slot_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2411 __ call_VM_leaf(entry_point, R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2412 restore_native_result(masm, ret_type, workspace_slot_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2413 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2414 if (is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2415 __ b(after_transition); // No thread state transition here. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2416 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2417 __ bind(no_block); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2418 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2419 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2420 // Publish thread state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2421 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2422 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2423 // Thread state is thread_in_native_trans. Any safepoint blocking has |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2424 // already happened so we can now change state to _thread_in_Java. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2425 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2426 // Transition from _thread_in_native_trans to _thread_in_Java. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2427 __ li(R0, _thread_in_Java); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2428 __ release(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2429 // TODO: PPC port assert(4 == JavaThread::sz_thread_state(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2430 __ stw(R0, thread_(thread_state)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2431 if (UseMembar) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2432 __ fence(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2433 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2434 __ bind(after_transition); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2435 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2436 // Reguard any pages if necessary. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2437 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2438 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2439 Label no_reguard; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2440 __ lwz(r_temp_1, thread_(stack_guard_state)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2441 __ cmpwi(CCR0, r_temp_1, JavaThread::stack_guard_yellow_disabled); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2442 __ bne(CCR0, no_reguard); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2443 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2444 save_native_result(masm, ret_type, workspace_slot_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2445 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2446 restore_native_result(masm, ret_type, workspace_slot_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2447 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2448 __ bind(no_reguard); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2449 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2450 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2451 // Unlock |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2452 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2453 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2454 if (method->is_synchronized()) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2455 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2456 ConditionRegister r_flag = CCR1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2457 const Register r_oop = r_temp_4; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2458 const Register r_box = r_temp_5; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2459 const Register r_exception = r_temp_6; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2460 Label done; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2461 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2462 // Get oop and address of lock object box. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2463 if (method_is_static) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2464 assert(klass_offset != -1, ""); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2465 __ ld(r_oop, klass_offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2466 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2467 assert(receiver_offset != -1, ""); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2468 __ ld(r_oop, receiver_offset, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2469 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2470 __ addi(r_box, R1_SP, lock_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2471 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2472 // Try fastpath for unlocking. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2473 __ compiler_fast_unlock_object(r_flag, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2474 __ beq(r_flag, done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2475 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2476 // Save and restore any potential method result value around the unlocking operation. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2477 save_native_result(masm, ret_type, workspace_slot_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2478 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2479 // Must save pending exception around the slow-path VM call. Since it's a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2480 // leaf call, the pending exception (if any) can be kept in a register. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2481 __ ld(r_exception, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2482 assert(r_exception->is_nonvolatile(), "exception register must be non-volatile"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2483 __ li(R0, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2484 __ std(R0, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2485 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2486 // Slow case of monitor enter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2487 // Inline a special case of call_VM that disallows any pending_exception. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2488 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), r_oop, r_box); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2489 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2490 __ asm_assert_mem8_is_zero(thread_(pending_exception), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2491 "no pending exception allowed on exit from SharedRuntime::complete_monitor_unlocking_C", 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2492 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2493 restore_native_result(masm, ret_type, workspace_slot_offset); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2494 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2495 // Check_forward_pending_exception jump to forward_exception if any pending |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2496 // exception is set. The forward_exception routine expects to see the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2497 // exception in pending_exception and not in a register. Kind of clumsy, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2498 // since all folks who branch to forward_exception must have tested |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2499 // pending_exception first and hence have it in a register already. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2500 __ std(r_exception, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2501 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2502 __ bind(done); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2503 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2504 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2505 # if 0 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2506 // DTrace method exit |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2507 # endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2508 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2509 // Clear "last Java frame" SP and PC. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2510 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2511 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2512 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2513 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2514 // Unpack oop result. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2515 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2516 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2517 if (ret_type == T_OBJECT || ret_type == T_ARRAY) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2518 Label skip_unboxing; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2519 __ cmpdi(CCR0, R3_RET, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2520 __ beq(CCR0, skip_unboxing); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2521 __ ld(R3_RET, 0, R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2522 __ bind(skip_unboxing); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2523 __ verify_oop(R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2524 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2525 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2526 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2527 // Reset handle block. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2528 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2529 if (!is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2530 __ ld(r_temp_1, thread_(active_handles)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2531 // TODO: PPC port assert(4 == JNIHandleBlock::top_size_in_bytes(), "unexpected field size"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2532 __ li(r_temp_2, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2533 __ stw(r_temp_2, JNIHandleBlock::top_offset_in_bytes(), r_temp_1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2534 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2535 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2536 // Check for pending exceptions. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2537 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2538 __ ld(r_temp_2, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2539 __ cmpdi(CCR0, r_temp_2, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2540 __ bne(CCR0, handle_pending_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2541 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2542 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2543 // Return |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2544 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2545 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2546 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2547 __ restore_LR_CR(R11); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2548 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2549 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2550 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2551 // Handler for pending exceptions (out-of-line). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2552 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2553 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2554 // Since this is a native call, we know the proper exception handler |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2555 // is the empty function. We just pop this frame and then jump to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2556 // forward_exception_entry. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2557 if (!is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2558 __ align(InteriorEntryAlignment); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2559 __ bind(handle_pending_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2560 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2561 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2562 __ restore_LR_CR(R11); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2563 __ b64_patchable((address)StubRoutines::forward_exception_entry(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2564 relocInfo::runtime_call_type); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2565 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2566 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2567 // Handler for a cache miss (out-of-line). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2568 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2569 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2570 if (!method_is_static) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2571 __ align(InteriorEntryAlignment); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2572 __ bind(ic_miss); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2573 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2574 __ b64_patchable((address)SharedRuntime::get_ic_miss_stub(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2575 relocInfo::runtime_call_type); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2576 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2577 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2578 // Done. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2579 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2580 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2581 __ flush(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2582 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2583 nmethod *nm = nmethod::new_native_nmethod(method, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2584 compile_id, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2585 masm->code(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2586 vep_start_pc-start_pc, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2587 frame_done_pc-start_pc, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2588 stack_slots / VMRegImpl::slots_per_word, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2589 (method_is_static ? in_ByteSize(klass_offset) : in_ByteSize(receiver_offset)), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2590 in_ByteSize(lock_offset), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2591 oop_maps); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2592 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2593 if (is_critical_native) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2594 nm->set_lazy_critical_native(true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2595 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2596 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2597 return nm; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2598 #else |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2599 ShouldNotReachHere(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2600 return NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2601 #endif // COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2602 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2603 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2604 // This function returns the adjust size (in number of words) to a c2i adapter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2605 // activation for use during deoptimization. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2606 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2607 return round_to((callee_locals - callee_parameters) * Interpreter::stackElementWords, frame::alignment_in_bytes); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2608 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2609 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2610 uint SharedRuntime::out_preserve_stack_slots() { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2611 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2612 return frame::jit_out_preserve_size / VMRegImpl::stack_slot_size; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2613 #else |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2614 return 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2615 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2616 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2617 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2618 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2619 // Frame generation for deopt and uncommon trap blobs. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2620 static void push_skeleton_frame(MacroAssembler* masm, bool deopt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2621 /* Read */ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2622 Register unroll_block_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2623 /* Update */ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2624 Register frame_sizes_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2625 Register number_of_frames_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2626 Register pcs_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2627 /* Invalidate */ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2628 Register frame_size_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2629 Register pc_reg) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2630 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2631 __ ld(pc_reg, 0, pcs_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2632 __ ld(frame_size_reg, 0, frame_sizes_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2633 __ std(pc_reg, _abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2634 __ push_frame(frame_size_reg, R0/*tmp*/); |
14445 | 2635 #ifdef CC_INTERP |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2636 __ std(R1_SP, _parent_ijava_frame_abi(initial_caller_sp), R1_SP); |
14445 | 2637 #else |
14694 | 2638 #ifdef ASSERT |
2639 __ load_const_optimized(pc_reg, 0x5afe); | |
2640 __ std(pc_reg, _ijava_state_neg(ijava_reserved), R1_SP); | |
14445 | 2641 #endif |
14694 | 2642 __ std(R1_SP, _ijava_state_neg(sender_sp), R1_SP); |
2643 #endif // CC_INTERP | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2644 __ addi(number_of_frames_reg, number_of_frames_reg, -1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2645 __ addi(frame_sizes_reg, frame_sizes_reg, wordSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2646 __ addi(pcs_reg, pcs_reg, wordSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2647 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2648 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2649 // Loop through the UnrollBlock info and create new frames. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2650 static void push_skeleton_frames(MacroAssembler* masm, bool deopt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2651 /* read */ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2652 Register unroll_block_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2653 /* invalidate */ |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2654 Register frame_sizes_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2655 Register number_of_frames_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2656 Register pcs_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2657 Register frame_size_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2658 Register pc_reg) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2659 Label loop; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2660 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2661 // _number_of_frames is of type int (deoptimization.hpp) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2662 __ lwa(number_of_frames_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2663 Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2664 unroll_block_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2665 __ ld(pcs_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2666 Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2667 unroll_block_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2668 __ ld(frame_sizes_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2669 Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2670 unroll_block_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2671 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2672 // stack: (caller_of_deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2673 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2674 // At this point we either have an interpreter frame or a compiled |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2675 // frame on top of stack. If it is a compiled frame we push a new c2i |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2676 // adapter here |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2677 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2678 // Memorize top-frame stack-pointer. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2679 __ mr(frame_size_reg/*old_sp*/, R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2680 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2681 // Resize interpreter top frame OR C2I adapter. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2682 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2683 // At this moment, the top frame (which is the caller of the deoptee) is |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2684 // an interpreter frame or a newly pushed C2I adapter or an entry frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2685 // The top frame has a TOP_IJAVA_FRAME_ABI and the frame contains the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2686 // outgoing arguments. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2687 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2688 // In order to push the interpreter frame for the deoptee, we need to |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2689 // resize the top frame such that we are able to place the deoptee's |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2690 // locals in the frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2691 // Additionally, we have to turn the top frame's TOP_IJAVA_FRAME_ABI |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2692 // into a valid PARENT_IJAVA_FRAME_ABI. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2693 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2694 __ lwa(R11_scratch1, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2695 Deoptimization::UnrollBlock::caller_adjustment_offset_in_bytes(), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2696 unroll_block_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2697 __ neg(R11_scratch1, R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2698 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2699 // R11_scratch1 contains size of locals for frame resizing. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2700 // R12_scratch2 contains top frame's lr. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2701 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2702 // Resize frame by complete frame size prevents TOC from being |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2703 // overwritten by locals. A more stack space saving way would be |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2704 // to copy the TOC to its location in the new abi. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2705 __ addi(R11_scratch1, R11_scratch1, - frame::parent_ijava_frame_abi_size); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2706 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2707 // now, resize the frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2708 __ resize_frame(R11_scratch1, pc_reg/*tmp*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2709 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2710 // In the case where we have resized a c2i frame above, the optional |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2711 // alignment below the locals has size 32 (why?). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2712 __ std(R12_scratch2, _abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2713 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2714 // Initialize initial_caller_sp. |
14694 | 2715 #ifdef CC_INTERP |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2716 __ std(frame_size_reg/*old_sp*/, _parent_ijava_frame_abi(initial_caller_sp), R1_SP); |
14694 | 2717 #else |
2718 #ifdef ASSERT | |
2719 __ load_const_optimized(pc_reg, 0x5afe); | |
2720 __ std(pc_reg, _ijava_state_neg(ijava_reserved), R1_SP); | |
2721 #endif | |
2722 __ std(frame_size_reg, _ijava_state_neg(sender_sp), R1_SP); | |
2723 #endif // CC_INTERP | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2724 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2725 #ifdef ASSERT |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2726 // Make sure that there is at least one entry in the array. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2727 __ cmpdi(CCR0, number_of_frames_reg, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2728 __ asm_assert_ne("array_size must be > 0", 0x205); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2729 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2730 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2731 // Now push the new interpreter frames. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2732 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2733 __ bind(loop); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2734 // Allocate a new frame, fill in the pc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2735 push_skeleton_frame(masm, deopt, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2736 unroll_block_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2737 frame_sizes_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2738 number_of_frames_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2739 pcs_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2740 frame_size_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2741 pc_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2742 __ cmpdi(CCR0, number_of_frames_reg, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2743 __ bne(CCR0, loop); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2744 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2745 // Get the return address pointing into the frame manager. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2746 __ ld(R0, 0, pcs_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2747 // Store it in the top interpreter frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2748 __ std(R0, _abi(lr), R1_SP); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2749 // Initialize frame_manager_lr of interpreter top frame. |
14445 | 2750 #ifdef CC_INTERP |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2751 __ std(R0, _top_ijava_frame_abi(frame_manager_lr), R1_SP); |
14445 | 2752 #endif |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2753 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2754 #endif |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2755 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2756 void SharedRuntime::generate_deopt_blob() { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2757 // Allocate space for the code |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2758 ResourceMark rm; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2759 // Setup code generation tools |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2760 CodeBuffer buffer("deopt_blob", 2048, 1024); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2761 InterpreterMacroAssembler* masm = new InterpreterMacroAssembler(&buffer); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2762 Label exec_mode_initialized; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2763 int frame_size_in_words; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2764 OopMap* map = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2765 OopMapSet *oop_maps = new OopMapSet(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2766 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2767 // size of ABI112 plus spill slots for R3_RET and F1_RET. |
14684 | 2768 const int frame_size_in_bytes = frame::abi_reg_args_spill_size; |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2769 const int frame_size_in_slots = frame_size_in_bytes / sizeof(jint); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2770 int first_frame_size_in_bytes = 0; // frame size of "unpack frame" for call to fetch_unroll_info. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2771 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2772 const Register exec_mode_reg = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2773 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2774 const address start = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2775 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2776 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2777 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2778 // Prolog for non exception case! |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2779 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2780 // We have been called from the deopt handler of the deoptee. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2781 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2782 // deoptee: |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2783 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2784 // call X |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2785 // ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2786 // deopt_handler: call_deopt_stub |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2787 // cur. return pc --> ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2788 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2789 // So currently SR_LR points behind the call in the deopt handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2790 // We adjust it such that it points to the start of the deopt handler. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2791 // The return_pc has been stored in the frame of the deoptee and |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2792 // will replace the address of the deopt_handler in the call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2793 // to Deoptimization::fetch_unroll_info below. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2794 // We can't grab a free register here, because all registers may |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2795 // contain live values, so let the RegisterSaver do the adjustment |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2796 // of the return pc. |
17809
a433eb716ce1
8037821: Account for trampoline stubs when estimating code buffer sizes
goetz
parents:
14694
diff
changeset
|
2797 const int return_pc_adjustment_no_exception = -HandlerImpl::size_deopt_handler(); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2798 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2799 // Push the "unpack frame" |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2800 // Save everything in sight. |
14684 | 2801 map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, |
2802 &first_frame_size_in_bytes, | |
2803 /*generate_oop_map=*/ true, | |
2804 return_pc_adjustment_no_exception, | |
2805 RegisterSaver::return_pc_is_lr); | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2806 assert(map != NULL, "OopMap must have been created"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2807 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2808 __ li(exec_mode_reg, Deoptimization::Unpack_deopt); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2809 // Save exec mode for unpack_frames. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2810 __ b(exec_mode_initialized); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2811 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2812 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2813 // Prolog for exception case |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2814 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2815 // An exception is pending. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2816 // We have been called with a return (interpreter) or a jump (exception blob). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2817 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2818 // - R3_ARG1: exception oop |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2819 // - R4_ARG2: exception pc |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2820 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2821 int exception_offset = __ pc() - start; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2822 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2823 BLOCK_COMMENT("Prolog for exception case"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2824 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2825 // The RegisterSaves doesn't need to adjust the return pc for this situation. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2826 const int return_pc_adjustment_exception = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2827 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2828 // Push the "unpack frame". |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2829 // Save everything in sight. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2830 assert(R4 == R4_ARG2, "exception pc must be in r4"); |
14684 | 2831 RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, |
2832 &first_frame_size_in_bytes, | |
2833 /*generate_oop_map=*/ false, | |
2834 return_pc_adjustment_exception, | |
2835 RegisterSaver::return_pc_is_r4); | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2836 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2837 // Deopt during an exception. Save exec mode for unpack_frames. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2838 __ li(exec_mode_reg, Deoptimization::Unpack_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2839 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2840 // Store exception oop and pc in thread (location known to GC). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2841 // This is needed since the call to "fetch_unroll_info()" may safepoint. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2842 __ std(R3_ARG1, in_bytes(JavaThread::exception_oop_offset()), R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2843 __ std(R4_ARG2, in_bytes(JavaThread::exception_pc_offset()), R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2844 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2845 // fall through |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2846 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2847 // -------------------------------------------------------------------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2848 __ BIND(exec_mode_initialized); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2849 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2850 { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2851 const Register unroll_block_reg = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2852 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2853 // We need to set `last_Java_frame' because `fetch_unroll_info' will |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2854 // call `last_Java_frame()'. The value of the pc in the frame is not |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2855 // particularly important. It just needs to identify this blob. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2856 __ set_last_Java_frame(R1_SP, noreg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2857 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2858 // With EscapeAnalysis turned on, this call may safepoint! |
22717
ba7846fcb814
Fix ppc and x86_32 after fetch_unroll_info_helper changes
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
17809
diff
changeset
|
2859 __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info), R16_thread, exec_mode_reg); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2860 address calls_return_pc = __ last_calls_return_pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2861 // Set an oopmap for the call site that describes all our saved registers. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2862 oop_maps->add_gc_map(calls_return_pc - start, map); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2863 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2864 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2865 // Save the return value. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2866 __ mr(unroll_block_reg, R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2867 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2868 // Restore only the result registers that have been saved |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2869 // by save_volatile_registers(...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2870 RegisterSaver::restore_result_registers(masm, first_frame_size_in_bytes); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2871 |
22717
ba7846fcb814
Fix ppc and x86_32 after fetch_unroll_info_helper changes
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
17809
diff
changeset
|
2872 // reload the exec mode from the UnrollBlock (it might have changed) |
ba7846fcb814
Fix ppc and x86_32 after fetch_unroll_info_helper changes
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
17809
diff
changeset
|
2873 __ lwz(exec_mode_reg, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes(), unroll_block_reg); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2874 // In excp_deopt_mode, restore and clear exception oop which we |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2875 // stored in the thread during exception entry above. The exception |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2876 // oop will be the return value of this stub. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2877 Label skip_restore_excp; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2878 __ cmpdi(CCR0, exec_mode_reg, Deoptimization::Unpack_exception); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2879 __ bne(CCR0, skip_restore_excp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2880 __ ld(R3_RET, in_bytes(JavaThread::exception_oop_offset()), R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2881 __ ld(R4_ARG2, in_bytes(JavaThread::exception_pc_offset()), R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2882 __ li(R0, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2883 __ std(R0, in_bytes(JavaThread::exception_pc_offset()), R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2884 __ std(R0, in_bytes(JavaThread::exception_oop_offset()), R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2885 __ BIND(skip_restore_excp); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2886 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2887 // reload narrro_oop_base |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2888 if (UseCompressedOops && Universe::narrow_oop_base() != 0) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2889 __ load_const_optimized(R30, Universe::narrow_oop_base()); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2890 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2891 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2892 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2893 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2894 // stack: (deoptee, optional i2c, caller of deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2895 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2896 // pop the deoptee's frame |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2897 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2898 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2899 // stack: (caller_of_deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2900 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2901 // Loop through the `UnrollBlock' info and create interpreter frames. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2902 push_skeleton_frames(masm, true/*deopt*/, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2903 unroll_block_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2904 R23_tmp3, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2905 R24_tmp4, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2906 R25_tmp5, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2907 R26_tmp6, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2908 R27_tmp7); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2909 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2910 // stack: (skeletal interpreter frame, ..., optional skeletal |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2911 // interpreter frame, optional c2i, caller of deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2912 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2913 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2914 // push an `unpack_frame' taking care of float / int return values. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2915 __ push_frame(frame_size_in_bytes, R0/*tmp*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2916 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2917 // stack: (unpack frame, skeletal interpreter frame, ..., optional |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2918 // skeletal interpreter frame, optional c2i, caller of deoptee, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2919 // ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2920 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2921 // Spill live volatile registers since we'll do a call. |
14684 | 2922 __ std( R3_RET, _abi_reg_args_spill(spill_ret), R1_SP); |
2923 __ stfd(F1_RET, _abi_reg_args_spill(spill_fret), R1_SP); | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2924 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2925 // Let the unpacker layout information in the skeletal frames just |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2926 // allocated. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2927 __ get_PC_trash_LR(R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2928 __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2929 // This is a call to a LEAF method, so no oop map is required. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2930 __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2931 R16_thread/*thread*/, exec_mode_reg/*exec_mode*/); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2932 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2933 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2934 // Restore the volatiles saved above. |
14684 | 2935 __ ld( R3_RET, _abi_reg_args_spill(spill_ret), R1_SP); |
2936 __ lfd(F1_RET, _abi_reg_args_spill(spill_fret), R1_SP); | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2937 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2938 // Pop the unpack frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2939 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2940 __ restore_LR_CR(R0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2941 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2942 // stack: (top interpreter frame, ..., optional interpreter frame, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2943 // optional c2i, caller of deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2944 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2945 // Initialize R14_state. |
14694 | 2946 #ifdef CC_INTERP |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2947 __ ld(R14_state, 0, R1_SP); |
14445 | 2948 __ addi(R14_state, R14_state, -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2949 // Also inititialize R15_prev_state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2950 __ restore_prev_state(); |
14694 | 2951 #else |
2952 __ restore_interpreter_state(R11_scratch1); | |
2953 __ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); | |
2954 #endif // CC_INTERP | |
2955 | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2956 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2957 // Return to the interpreter entry point. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2958 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2959 __ flush(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2960 #else // COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2961 __ unimplemented("deopt blob needed only with compiler"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2962 int exception_offset = __ pc() - start; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2963 #endif // COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2964 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2965 _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, 0, first_frame_size_in_bytes / wordSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2966 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2967 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2968 #ifdef COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2969 void SharedRuntime::generate_uncommon_trap_blob() { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2970 // Allocate space for the code. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2971 ResourceMark rm; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2972 // Setup code generation tools. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2973 CodeBuffer buffer("uncommon_trap_blob", 2048, 1024); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2974 InterpreterMacroAssembler* masm = new InterpreterMacroAssembler(&buffer); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2975 address start = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2976 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2977 Register unroll_block_reg = R21_tmp1; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2978 Register klass_index_reg = R22_tmp2; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2979 Register unc_trap_reg = R23_tmp3; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2980 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2981 OopMapSet* oop_maps = new OopMapSet(); |
14684 | 2982 int frame_size_in_bytes = frame::abi_reg_args_size; |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2983 OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2984 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2985 // stack: (deoptee, optional i2c, caller_of_deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2986 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2987 // Push a dummy `unpack_frame' and call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2988 // `Deoptimization::uncommon_trap' to pack the compiled frame into a |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2989 // vframe array and return the `UnrollBlock' information. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2990 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2991 // Save LR to compiled frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2992 __ save_LR_CR(R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2993 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2994 // Push an "uncommon_trap" frame. |
14684 | 2995 __ push_frame_reg_args(0, R11_scratch1); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2996 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2997 // stack: (unpack frame, deoptee, optional i2c, caller_of_deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2998 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2999 // Set the `unpack_frame' as last_Java_frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3000 // `Deoptimization::uncommon_trap' expects it and considers its |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3001 // sender frame as the deoptee frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3002 // Remember the offset of the instruction whose address will be |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3003 // moved to R11_scratch1. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3004 address gc_map_pc = __ get_PC_trash_LR(R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3005 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3006 __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3007 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3008 __ mr(klass_index_reg, R3); |
22717
ba7846fcb814
Fix ppc and x86_32 after fetch_unroll_info_helper changes
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
17809
diff
changeset
|
3009 __ li(R5, Deoptimization::Unpack_exception); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3010 __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap), |
22717
ba7846fcb814
Fix ppc and x86_32 after fetch_unroll_info_helper changes
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
17809
diff
changeset
|
3011 R16_thread, klass_index_reg, R5); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3012 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3013 // Set an oopmap for the call site. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3014 oop_maps->add_gc_map(gc_map_pc - start, map); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3015 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3016 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3017 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3018 // Pop the `unpack frame'. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3019 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3020 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3021 // stack: (deoptee, optional i2c, caller_of_deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3022 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3023 // Save the return value. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3024 __ mr(unroll_block_reg, R3_RET); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3025 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3026 // Pop the uncommon_trap frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3027 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3028 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3029 // stack: (caller_of_deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3030 |
22720
48fde4d03767
Add assert for Unpack_uncommon_trap for ppc and always check for rethrow_exception
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22717
diff
changeset
|
3031 #ifdef ASSERT |
48fde4d03767
Add assert for Unpack_uncommon_trap for ppc and always check for rethrow_exception
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22717
diff
changeset
|
3032 __ lwz(R22_tmp2, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes(), unroll_block_reg); |
48fde4d03767
Add assert for Unpack_uncommon_trap for ppc and always check for rethrow_exception
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22717
diff
changeset
|
3033 __ cmpdi(CCR0, R22_tmp2, Deoptimization::Unpack_uncommon_trap); |
48fde4d03767
Add assert for Unpack_uncommon_trap for ppc and always check for rethrow_exception
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22717
diff
changeset
|
3034 __ asm_assert_eq("SharedRuntime::generate_deopt_blob: expected Unpack_uncommon_trap", 0); |
48fde4d03767
Add assert for Unpack_uncommon_trap for ppc and always check for rethrow_exception
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22717
diff
changeset
|
3035 #endif |
48fde4d03767
Add assert for Unpack_uncommon_trap for ppc and always check for rethrow_exception
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22717
diff
changeset
|
3036 |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3037 // Allocate new interpreter frame(s) and possibly a c2i adapter |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3038 // frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3039 push_skeleton_frames(masm, false/*deopt*/, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3040 unroll_block_reg, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3041 R22_tmp2, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3042 R23_tmp3, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3043 R24_tmp4, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3044 R25_tmp5, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3045 R26_tmp6); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3046 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3047 // stack: (skeletal interpreter frame, ..., optional skeletal |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3048 // interpreter frame, optional c2i, caller of deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3049 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3050 // Push a dummy `unpack_frame' taking care of float return values. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3051 // Call `Deoptimization::unpack_frames' to layout information in the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3052 // interpreter frames just created. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3053 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3054 // Push a simple "unpack frame" here. |
14684 | 3055 __ push_frame_reg_args(0, R11_scratch1); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3056 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3057 // stack: (unpack frame, skeletal interpreter frame, ..., optional |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3058 // skeletal interpreter frame, optional c2i, caller of deoptee, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3059 // ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3060 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3061 // Set the "unpack_frame" as last_Java_frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3062 __ get_PC_trash_LR(R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3063 __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3064 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3065 // Indicate it is the uncommon trap case. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3066 __ li(unc_trap_reg, Deoptimization::Unpack_uncommon_trap); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3067 // Let the unpacker layout information in the skeletal frames just |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3068 // allocated. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3069 __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames), |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3070 R16_thread, unc_trap_reg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3071 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3072 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3073 // Pop the `unpack frame'. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3074 __ pop_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3075 // Restore LR from top interpreter frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3076 __ restore_LR_CR(R11_scratch1); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3077 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3078 // stack: (top interpreter frame, ..., optional interpreter frame, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3079 // optional c2i, caller of deoptee, ...). |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3080 |
14694 | 3081 #ifdef CC_INTERP |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3082 // Initialize R14_state, ... |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3083 __ ld(R11_scratch1, 0, R1_SP); |
14445 | 3084 __ addi(R14_state, R11_scratch1, -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3085 // also initialize R15_prev_state. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3086 __ restore_prev_state(); |
14694 | 3087 #else |
3088 __ restore_interpreter_state(R11_scratch1); | |
3089 __ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); | |
3090 #endif // CC_INTERP | |
3091 | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3092 // Return to the interpreter entry point. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3093 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3094 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3095 masm->flush(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3096 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3097 _uncommon_trap_blob = UncommonTrapBlob::create(&buffer, oop_maps, frame_size_in_bytes/wordSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3098 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3099 #endif // COMPILER2 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3100 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3101 // Generate a special Compile2Runtime blob that saves all registers, and setup oopmap. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3102 SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3103 assert(StubRoutines::forward_exception_entry() != NULL, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3104 "must be generated before"); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3105 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3106 ResourceMark rm; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3107 OopMapSet *oop_maps = new OopMapSet(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3108 OopMap* map; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3109 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3110 // Allocate space for the code. Setup code generation tools. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3111 CodeBuffer buffer("handler_blob", 2048, 1024); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3112 MacroAssembler* masm = new MacroAssembler(&buffer); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3113 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3114 address start = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3115 int frame_size_in_bytes = 0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3116 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3117 RegisterSaver::ReturnPCLocation return_pc_location; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3118 bool cause_return = (poll_type == POLL_AT_RETURN); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3119 if (cause_return) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3120 // Nothing to do here. The frame has already been popped in MachEpilogNode. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3121 // Register LR already contains the return pc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3122 return_pc_location = RegisterSaver::return_pc_is_lr; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3123 } else { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3124 // Use thread()->saved_exception_pc() as return pc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3125 return_pc_location = RegisterSaver::return_pc_is_thread_saved_exception_pc; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3126 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3127 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3128 // Save registers, fpu state, and flags. |
14684 | 3129 map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, |
3130 &frame_size_in_bytes, | |
3131 /*generate_oop_map=*/ true, | |
3132 /*return_pc_adjustment=*/0, | |
3133 return_pc_location); | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3134 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3135 // The following is basically a call_VM. However, we need the precise |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3136 // address of the call in order to generate an oopmap. Hence, we do all the |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3137 // work outselves. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3138 __ set_last_Java_frame(/*sp=*/R1_SP, /*pc=*/noreg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3139 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3140 // The return address must always be correct so that the frame constructor |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3141 // never sees an invalid pc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3142 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3143 // Do the call |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3144 __ call_VM_leaf(call_ptr, R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3145 address calls_return_pc = __ last_calls_return_pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3146 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3147 // Set an oopmap for the call site. This oopmap will map all |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3148 // oop-registers and debug-info registers as callee-saved. This |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3149 // will allow deoptimization at this safepoint to find all possible |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3150 // debug-info recordings, as well as let GC find all oops. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3151 oop_maps->add_gc_map(calls_return_pc - start, map); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3152 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3153 Label noException; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3154 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3155 // Clear the last Java frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3156 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3157 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3158 BLOCK_COMMENT(" Check pending exception."); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3159 const Register pending_exception = R0; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3160 __ ld(pending_exception, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3161 __ cmpdi(CCR0, pending_exception, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3162 __ beq(CCR0, noException); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3163 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3164 // Exception pending |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3165 RegisterSaver::restore_live_registers_and_pop_frame(masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3166 frame_size_in_bytes, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3167 /*restore_ctr=*/true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3168 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3169 BLOCK_COMMENT(" Jump to forward_exception_entry."); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3170 // Jump to forward_exception_entry, with the issuing PC in LR |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3171 // so it looks like the original nmethod called forward_exception_entry. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3172 __ b64_patchable(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3173 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3174 // No exception case. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3175 __ BIND(noException); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3176 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3177 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3178 // Normal exit, restore registers and exit. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3179 RegisterSaver::restore_live_registers_and_pop_frame(masm, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3180 frame_size_in_bytes, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3181 /*restore_ctr=*/true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3182 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3183 __ blr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3184 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3185 // Make sure all code is generated |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3186 masm->flush(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3187 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3188 // Fill-out other meta info |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3189 // CodeBlob frame size is in words. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3190 return SafepointBlob::create(&buffer, oop_maps, frame_size_in_bytes / wordSize); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3191 } |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3192 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3193 // generate_resolve_blob - call resolution (static/virtual/opt-virtual/ic-miss) |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3194 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3195 // Generate a stub that calls into the vm to find out the proper destination |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3196 // of a java call. All the argument registers are live at this point |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3197 // but since this is generic code we don't know what they are and the caller |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3198 // must do any gc of the args. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3199 // |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3200 RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) { |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3201 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3202 // allocate space for the code |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3203 ResourceMark rm; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3204 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3205 CodeBuffer buffer(name, 1000, 512); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3206 MacroAssembler* masm = new MacroAssembler(&buffer); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3207 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3208 int frame_size_in_bytes; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3209 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3210 OopMapSet *oop_maps = new OopMapSet(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3211 OopMap* map = NULL; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3212 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3213 address start = __ pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3214 |
14684 | 3215 map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, |
3216 &frame_size_in_bytes, | |
3217 /*generate_oop_map*/ true, | |
3218 /*return_pc_adjustment*/ 0, | |
3219 RegisterSaver::return_pc_is_lr); | |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3220 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3221 // Use noreg as last_Java_pc, the return pc will be reconstructed |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3222 // from the physical frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3223 __ set_last_Java_frame(/*sp*/R1_SP, noreg); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3224 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3225 int frame_complete = __ offset(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3226 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3227 // Pass R19_method as 2nd (optional) argument, used by |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3228 // counter_overflow_stub. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3229 __ call_VM_leaf(destination, R16_thread, R19_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3230 address calls_return_pc = __ last_calls_return_pc(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3231 // Set an oopmap for the call site. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3232 // We need this not only for callee-saved registers, but also for volatile |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3233 // registers that the compiler might be keeping live across a safepoint. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3234 // Create the oopmap for the call's return pc. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3235 oop_maps->add_gc_map(calls_return_pc - start, map); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3236 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3237 // R3_RET contains the address we are going to jump to assuming no exception got installed. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3238 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3239 // clear last_Java_sp |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3240 __ reset_last_Java_frame(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3241 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3242 // Check for pending exceptions. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3243 BLOCK_COMMENT("Check for pending exceptions."); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3244 Label pending; |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3245 __ ld(R11_scratch1, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3246 __ cmpdi(CCR0, R11_scratch1, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3247 __ bne(CCR0, pending); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3248 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3249 __ mtctr(R3_RET); // Ctr will not be touched by restore_live_registers_and_pop_frame. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3250 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3251 RegisterSaver::restore_live_registers_and_pop_frame(masm, frame_size_in_bytes, /*restore_ctr*/ false); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3252 |
14694 | 3253 // Get the returned method. |
14408
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3254 __ get_vm_result_2(R19_method); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3255 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3256 __ bctr(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3257 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3258 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3259 // Pending exception after the safepoint. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3260 __ BIND(pending); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3261 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3262 RegisterSaver::restore_live_registers_and_pop_frame(masm, frame_size_in_bytes, /*restore_ctr*/ true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3263 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3264 // exception pending => remove activation and forward to exception handler |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3265 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3266 __ li(R11_scratch1, 0); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3267 __ ld(R3_ARG1, thread_(pending_exception)); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3268 __ std(R11_scratch1, in_bytes(JavaThread::vm_result_offset()), R16_thread); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3269 __ b64_patchable(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3270 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3271 // ------------- |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3272 // Make sure all code is generated. |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3273 masm->flush(); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3274 |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3275 // return the blob |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3276 // frame_size_words or bytes?? |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3277 return RuntimeStub::new_runtime_stub(name, &buffer, frame_complete, frame_size_in_bytes/wordSize, |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3278 oop_maps, true); |
ec28f9c041ff
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3279 } |