Mercurial > hg > truffle
comparison src/share/vm/interpreter/rewriter.cpp @ 1579:e9ff18c4ace7
Merge
author | jrose |
---|---|
date | Wed, 02 Jun 2010 22:45:42 -0700 |
parents | c18cbe5936b8 1eb493f33423 |
children | 136b78722a08 |
comparison
equal
deleted
inserted
replaced
1562:dfe27f03244a | 1579:e9ff18c4ace7 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 | 104 |
105 // Rewrite a classfile-order CP index into a native-order CPC index. | 105 // Rewrite a classfile-order CP index into a native-order CPC index. |
106 int Rewriter::rewrite_member_reference(address bcp, int offset) { | 106 void Rewriter::rewrite_member_reference(address bcp, int offset) { |
107 address p = bcp + offset; | 107 address p = bcp + offset; |
108 int cp_index = Bytes::get_Java_u2(p); | 108 int cp_index = Bytes::get_Java_u2(p); |
109 int cache_index = cp_entry_to_cp_cache(cp_index); | 109 int cache_index = cp_entry_to_cp_cache(cp_index); |
110 Bytes::put_native_u2(p, cache_index); | 110 Bytes::put_native_u2(p, cache_index); |
111 return cp_index; | 111 } |
112 } | 112 |
113 | 113 |
114 | 114 void Rewriter::rewrite_invokedynamic(address bcp, int offset) { |
115 void Rewriter::rewrite_invokedynamic(address bcp, int offset, int delete_me) { | |
116 address p = bcp + offset; | 115 address p = bcp + offset; |
117 assert(p[-1] == Bytecodes::_invokedynamic, ""); | 116 assert(p[-1] == Bytecodes::_invokedynamic, ""); |
118 int cp_index = Bytes::get_Java_u2(p); | 117 int cp_index = Bytes::get_Java_u2(p); |
119 int cpc = maybe_add_cp_cache_entry(cp_index); // add lazily | 118 int cpc = maybe_add_cp_cache_entry(cp_index); // add lazily |
120 int cpc2 = add_secondary_cp_cache_entry(cpc); | 119 int cpc2 = add_secondary_cp_cache_entry(cpc); |
176 | 175 |
177 switch (c) { | 176 switch (c) { |
178 case Bytecodes::_lookupswitch : { | 177 case Bytecodes::_lookupswitch : { |
179 #ifndef CC_INTERP | 178 #ifndef CC_INTERP |
180 Bytecode_lookupswitch* bc = Bytecode_lookupswitch_at(bcp); | 179 Bytecode_lookupswitch* bc = Bytecode_lookupswitch_at(bcp); |
181 bc->set_code( | 180 (*bcp) = ( |
182 bc->number_of_pairs() < BinarySwitchThreshold | 181 bc->number_of_pairs() < BinarySwitchThreshold |
183 ? Bytecodes::_fast_linearswitch | 182 ? Bytecodes::_fast_linearswitch |
184 : Bytecodes::_fast_binaryswitch | 183 : Bytecodes::_fast_binaryswitch |
185 ); | 184 ); |
186 #endif | 185 #endif |
195 case Bytecodes::_invokestatic : | 194 case Bytecodes::_invokestatic : |
196 case Bytecodes::_invokeinterface: | 195 case Bytecodes::_invokeinterface: |
197 rewrite_member_reference(bcp, prefix_length+1); | 196 rewrite_member_reference(bcp, prefix_length+1); |
198 break; | 197 break; |
199 case Bytecodes::_invokedynamic: | 198 case Bytecodes::_invokedynamic: |
200 rewrite_invokedynamic(bcp, prefix_length+1, int(sizeof"@@@@DELETE ME")); | 199 rewrite_invokedynamic(bcp, prefix_length+1); |
201 break; | 200 break; |
202 case Bytecodes::_jsr : // fall through | 201 case Bytecodes::_jsr : // fall through |
203 case Bytecodes::_jsr_w : nof_jsrs++; break; | 202 case Bytecodes::_jsr_w : nof_jsrs++; break; |
204 case Bytecodes::_monitorenter : // fall through | 203 case Bytecodes::_monitorenter : // fall through |
205 case Bytecodes::_monitorexit : has_monitor_bytecodes = true; break; | 204 case Bytecodes::_monitorexit : has_monitor_bytecodes = true; break; |
306 _methods->obj_at_put(i, m()); | 305 _methods->obj_at_put(i, m()); |
307 } | 306 } |
308 | 307 |
309 // Set up method entry points for compiler and interpreter. | 308 // Set up method entry points for compiler and interpreter. |
310 m->link_method(m, CHECK); | 309 m->link_method(m, CHECK); |
311 } | 310 |
312 } | 311 #ifdef ASSERT |
312 if (StressMethodComparator) { | |
313 static int nmc = 0; | |
314 for (int j = i; j >= 0 && j >= i-4; j--) { | |
315 if ((++nmc % 1000) == 0) tty->print_cr("Have run MethodComparator %d times...", nmc); | |
316 bool z = MethodComparator::methods_EMCP(m(), (methodOop)_methods->obj_at(j)); | |
317 if (j == i && !z) { | |
318 tty->print("MethodComparator FAIL: "); m->print(); m->print_codes(); | |
319 assert(z, "method must compare equal to itself"); | |
320 } | |
321 } | |
322 } | |
323 #endif //ASSERT | |
324 } | |
325 } |