6939207: refactor constant pool index processing

Factored cleanup of instruction decode which prepares for enhanced ldc semantics.

Reviewed-by: twisti
This commit is contained in:
John R Rose 2010-05-23 01:38:26 -07:00
parent 2e24ba80e9
commit 581521ba96
40 changed files with 875 additions and 592 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -103,16 +103,15 @@ void Rewriter::rewrite_Object_init(methodHandle method, TRAPS) {
// Rewrite a classfile-order CP index into a native-order CPC index.
int Rewriter::rewrite_member_reference(address bcp, int offset) {
void Rewriter::rewrite_member_reference(address bcp, int offset) {
address p = bcp + offset;
int cp_index = Bytes::get_Java_u2(p);
int cache_index = cp_entry_to_cp_cache(cp_index);
Bytes::put_native_u2(p, cache_index);
return cp_index;
}
void Rewriter::rewrite_invokedynamic(address bcp, int offset, int delete_me) {
void Rewriter::rewrite_invokedynamic(address bcp, int offset) {
address p = bcp + offset;
assert(p[-1] == Bytecodes::_invokedynamic, "");
int cp_index = Bytes::get_Java_u2(p);
@ -178,7 +177,7 @@ void Rewriter::scan_method(methodOop method) {
case Bytecodes::_lookupswitch : {
#ifndef CC_INTERP
Bytecode_lookupswitch* bc = Bytecode_lookupswitch_at(bcp);
bc->set_code(
(*bcp) = (
bc->number_of_pairs() < BinarySwitchThreshold
? Bytecodes::_fast_linearswitch
: Bytecodes::_fast_binaryswitch
@ -197,7 +196,7 @@ void Rewriter::scan_method(methodOop method) {
rewrite_member_reference(bcp, prefix_length+1);
break;
case Bytecodes::_invokedynamic:
rewrite_invokedynamic(bcp, prefix_length+1, int(sizeof"@@@@DELETE ME"));
rewrite_invokedynamic(bcp, prefix_length+1);
break;
case Bytecodes::_jsr : // fall through
case Bytecodes::_jsr_w : nof_jsrs++; break;