diff options
author | twisti <none@none> | 2010-04-30 08:37:24 -0700 |
---|---|---|
committer | twisti <none@none> | 2010-04-30 08:37:24 -0700 |
commit | 38c1c67c3dbc30f9f9aa5af34bfb3b9399b5bc91 (patch) | |
tree | 5d0dd2fe8865622f8a71f66c4b0e81fd280b546a /src/share/vm | |
parent | dd6a6d2ec30960e98be4a86775b27cc13443c715 (diff) |
6943304: remove tagged stack interpreter
Reviewed-by: coleenp, never, gbenson
Diffstat (limited to 'src/share/vm')
-rw-r--r-- | src/share/vm/interpreter/abstractInterpreter.hpp | 73 | ||||
-rw-r--r-- | src/share/vm/interpreter/bytecodeInterpreter.cpp | 91 | ||||
-rw-r--r-- | src/share/vm/interpreter/interpreterRuntime.cpp | 4 | ||||
-rw-r--r-- | src/share/vm/oops/methodOop.cpp | 2 | ||||
-rw-r--r-- | src/share/vm/prims/methodHandles.hpp | 4 | ||||
-rw-r--r-- | src/share/vm/runtime/arguments.cpp | 11 | ||||
-rw-r--r-- | src/share/vm/runtime/frame.cpp | 173 | ||||
-rw-r--r-- | src/share/vm/runtime/frame.hpp | 26 | ||||
-rw-r--r-- | src/share/vm/runtime/globals.hpp | 5 | ||||
-rw-r--r-- | src/share/vm/runtime/javaCalls.cpp | 12 | ||||
-rw-r--r-- | src/share/vm/runtime/javaCalls.hpp | 8 | ||||
-rw-r--r-- | src/share/vm/runtime/sharedRuntime.cpp | 17 | ||||
-rw-r--r-- | src/share/vm/runtime/vframe.cpp | 129 | ||||
-rw-r--r-- | src/share/vm/runtime/vframeArray.cpp | 13 |
14 files changed, 88 insertions, 480 deletions
diff --git a/src/share/vm/interpreter/abstractInterpreter.hpp b/src/share/vm/interpreter/abstractInterpreter.hpp index 8ab9e40d3..72bf5c89d 100644 --- a/src/share/vm/interpreter/abstractInterpreter.hpp +++ b/src/share/vm/interpreter/abstractInterpreter.hpp @@ -167,60 +167,15 @@ class AbstractInterpreter: AllStatic { // Debugging/printing static void print(); // prints the interpreter code - // Support for Tagged Stacks - // - // Tags are stored on the Java Expression stack above the value: - // - // tag - // value - // - // For double values: - // - // tag2 - // high word - // tag1 - // low word - public: - static int stackElementWords() { return TaggedStackInterpreter ? 2 : 1; } - static int stackElementSize() { return stackElementWords()*wordSize; } - static int logStackElementSize() { return - TaggedStackInterpreter? LogBytesPerWord+1 : LogBytesPerWord; } - - // Tag is at pointer, value is one below for a stack growing down - // (or above for stack growing up) - static int value_offset_in_bytes() { - return TaggedStackInterpreter ? - frame::interpreter_frame_expression_stack_direction() * wordSize : 0; - } - static int tag_offset_in_bytes() { - assert(TaggedStackInterpreter, "should not call this"); - return 0; - } - - // Tagged Locals - // Locals are stored relative to Llocals: - // - // tag <- Llocals[n] - // value - // - // Category 2 types are indexed as: - // - // tag <- Llocals[-n] - // high word - // tag <- Llocals[-n+1] - // low word - // + // Interpreter helpers + const static int stackElementWords = 1; + const static int stackElementSize = stackElementWords * wordSize; + const static int logStackElementSize = LogBytesPerWord; // Local values relative to locals[n] static int local_offset_in_bytes(int n) { - return ((frame::interpreter_frame_expression_stack_direction() * n) * - stackElementSize()) + value_offset_in_bytes(); - } - static int local_tag_offset_in_bytes(int n) { - assert(TaggedStackInterpreter, "should not call this"); - return ((frame::interpreter_frame_expression_stack_direction() * n) * - stackElementSize()) + tag_offset_in_bytes(); + return ((frame::interpreter_frame_expression_stack_direction() * n) * stackElementSize); } // access to stacked values according to type: @@ -237,29 +192,15 @@ class AbstractInterpreter: AllStatic { static jlong long_in_slot(intptr_t* slot_addr) { if (sizeof(intptr_t) >= sizeof(jlong)) { return *(jlong*) slot_addr; - } else if (!TaggedStackInterpreter) { - return Bytes::get_native_u8((address)slot_addr); } else { - assert(sizeof(intptr_t) * 2 == sizeof(jlong), "ILP32"); - // assemble the long in memory order (not arithmetic order) - union { jlong j; jint i[2]; } u; - u.i[0] = (jint) slot_addr[0*stackElementSize()]; - u.i[1] = (jint) slot_addr[1*stackElementSize()]; - return u.j; + return Bytes::get_native_u8((address)slot_addr); } } static void set_long_in_slot(intptr_t* slot_addr, jlong value) { if (sizeof(intptr_t) >= sizeof(jlong)) { *(jlong*) slot_addr = value; - } else if (!TaggedStackInterpreter) { - Bytes::put_native_u8((address)slot_addr, value); } else { - assert(sizeof(intptr_t) * 2 == sizeof(jlong), "ILP32"); - // assemble the long in memory order (not arithmetic order) - union { jlong j; jint i[2]; } u; - u.j = value; - slot_addr[0*stackElementSize()] = (intptr_t) u.i[0]; - slot_addr[1*stackElementSize()] = (intptr_t) u.i[1]; + Bytes::put_native_u8((address)slot_addr, value); } } static void get_jvalue_in_slot(intptr_t* slot_addr, BasicType type, jvalue* value) { diff --git a/src/share/vm/interpreter/bytecodeInterpreter.cpp b/src/share/vm/interpreter/bytecodeInterpreter.cpp index a84003390..f93608f13 100644 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2002-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 @@ -2692,219 +2692,141 @@ BytecodeInterpreter::BytecodeInterpreter(messages msg) { // The implementations are platform dependent. We have to worry about alignment // issues on some machines which can change on the same platform depending on // whether it is an LP64 machine also. -#ifdef ASSERT -void BytecodeInterpreter::verify_stack_tag(intptr_t *tos, frame::Tag tag, int offset) { - if (TaggedStackInterpreter) { - frame::Tag t = (frame::Tag)tos[Interpreter::expr_tag_index_at(-offset)]; - assert(t == tag, "stack tag mismatch"); - } -} -#endif // ASSERT - address BytecodeInterpreter::stack_slot(intptr_t *tos, int offset) { - debug_only(verify_stack_tag(tos, frame::TagValue, offset)); return (address) tos[Interpreter::expr_index_at(-offset)]; } jint BytecodeInterpreter::stack_int(intptr_t *tos, int offset) { - debug_only(verify_stack_tag(tos, frame::TagValue, offset)); return *((jint*) &tos[Interpreter::expr_index_at(-offset)]); } jfloat BytecodeInterpreter::stack_float(intptr_t *tos, int offset) { - debug_only(verify_stack_tag(tos, frame::TagValue, offset)); return *((jfloat *) &tos[Interpreter::expr_index_at(-offset)]); } oop BytecodeInterpreter::stack_object(intptr_t *tos, int offset) { - debug_only(verify_stack_tag(tos, frame::TagReference, offset)); return (oop)tos [Interpreter::expr_index_at(-offset)]; } jdouble BytecodeInterpreter::stack_double(intptr_t *tos, int offset) { - debug_only(verify_stack_tag(tos, frame::TagValue, offset)); - debug_only(verify_stack_tag(tos, frame::TagValue, offset-1)); return ((VMJavaVal64*) &tos[Interpreter::expr_index_at(-offset)])->d; } jlong BytecodeInterpreter::stack_long(intptr_t *tos, int offset) { - debug_only(verify_stack_tag(tos, frame::TagValue, offset)); - debug_only(verify_stack_tag(tos, frame::TagValue, offset-1)); return ((VMJavaVal64 *) &tos[Interpreter::expr_index_at(-offset)])->l; } -void BytecodeInterpreter::tag_stack(intptr_t *tos, frame::Tag tag, int offset) { - if (TaggedStackInterpreter) - tos[Interpreter::expr_tag_index_at(-offset)] = (intptr_t)tag; -} - // only used for value types void BytecodeInterpreter::set_stack_slot(intptr_t *tos, address value, int offset) { - tag_stack(tos, frame::TagValue, offset); *((address *)&tos[Interpreter::expr_index_at(-offset)]) = value; } void BytecodeInterpreter::set_stack_int(intptr_t *tos, int value, int offset) { - tag_stack(tos, frame::TagValue, offset); *((jint *)&tos[Interpreter::expr_index_at(-offset)]) = value; } void BytecodeInterpreter::set_stack_float(intptr_t *tos, jfloat value, int offset) { - tag_stack(tos, frame::TagValue, offset); *((jfloat *)&tos[Interpreter::expr_index_at(-offset)]) = value; } void BytecodeInterpreter::set_stack_object(intptr_t *tos, oop value, int offset) { - tag_stack(tos, frame::TagReference, offset); *((oop *)&tos[Interpreter::expr_index_at(-offset)]) = value; } // needs to be platform dep for the 32 bit platforms. void BytecodeInterpreter::set_stack_double(intptr_t *tos, jdouble value, int offset) { - tag_stack(tos, frame::TagValue, offset); - tag_stack(tos, frame::TagValue, offset-1); ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset)])->d = value; } void BytecodeInterpreter::set_stack_double_from_addr(intptr_t *tos, address addr, int offset) { - tag_stack(tos, frame::TagValue, offset); - tag_stack(tos, frame::TagValue, offset-1); (((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset)])->d = ((VMJavaVal64*)addr)->d); } void BytecodeInterpreter::set_stack_long(intptr_t *tos, jlong value, int offset) { - tag_stack(tos, frame::TagValue, offset); ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset+1)])->l = 0xdeedbeeb; - tag_stack(tos, frame::TagValue, offset-1); ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset)])->l = value; } void BytecodeInterpreter::set_stack_long_from_addr(intptr_t *tos, address addr, int offset) { - tag_stack(tos, frame::TagValue, offset); ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset+1)])->l = 0xdeedbeeb; - tag_stack(tos, frame::TagValue, offset-1); ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset)])->l = ((VMJavaVal64*)addr)->l; } // Locals -#ifdef ASSERT -void BytecodeInterpreter::verify_locals_tag(intptr_t *locals, frame::Tag tag, - int offset) { - if (TaggedStackInterpreter) { - frame::Tag t = (frame::Tag)locals[Interpreter::local_tag_index_at(-offset)]; - assert(t == tag, "locals tag mismatch"); - } -} -#endif // ASSERT address BytecodeInterpreter::locals_slot(intptr_t* locals, int offset) { - debug_only(verify_locals_tag(locals, frame::TagValue, offset)); return (address)locals[Interpreter::local_index_at(-offset)]; } jint BytecodeInterpreter::locals_int(intptr_t* locals, int offset) { - debug_only(verify_locals_tag(locals, frame::TagValue, offset)); return (jint)locals[Interpreter::local_index_at(-offset)]; } jfloat BytecodeInterpreter::locals_float(intptr_t* locals, int offset) { - debug_only(verify_locals_tag(locals, frame::TagValue, offset)); return (jfloat)locals[Interpreter::local_index_at(-offset)]; } oop BytecodeInterpreter::locals_object(intptr_t* locals, int offset) { - debug_only(verify_locals_tag(locals, frame::TagReference, offset)); return (oop)locals[Interpreter::local_index_at(-offset)]; } jdouble BytecodeInterpreter::locals_double(intptr_t* locals, int offset) { - debug_only(verify_locals_tag(locals, frame::TagValue, offset)); - debug_only(verify_locals_tag(locals, frame::TagValue, offset)); return ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->d; } jlong BytecodeInterpreter::locals_long(intptr_t* locals, int offset) { - debug_only(verify_locals_tag(locals, frame::TagValue, offset)); - debug_only(verify_locals_tag(locals, frame::TagValue, offset+1)); return ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->l; } // Returns the address of locals value. address BytecodeInterpreter::locals_long_at(intptr_t* locals, int offset) { - debug_only(verify_locals_tag(locals, frame::TagValue, offset)); - debug_only(verify_locals_tag(locals, frame::TagValue, offset+1)); return ((address)&locals[Interpreter::local_index_at(-(offset+1))]); } address BytecodeInterpreter::locals_double_at(intptr_t* locals, int offset) { - debug_only(verify_locals_tag(locals, frame::TagValue, offset)); - debug_only(verify_locals_tag(locals, frame::TagValue, offset+1)); return ((address)&locals[Interpreter::local_index_at(-(offset+1))]); } -void BytecodeInterpreter::tag_locals(intptr_t *locals, frame::Tag tag, int offset) { - if (TaggedStackInterpreter) - locals[Interpreter::local_tag_index_at(-offset)] = (intptr_t)tag; -} - // Used for local value or returnAddress void BytecodeInterpreter::set_locals_slot(intptr_t *locals, address value, int offset) { - tag_locals(locals, frame::TagValue, offset); *((address*)&locals[Interpreter::local_index_at(-offset)]) = value; } void BytecodeInterpreter::set_locals_int(intptr_t *locals, jint value, int offset) { - tag_locals(locals, frame::TagValue, offset); *((jint *)&locals[Interpreter::local_index_at(-offset)]) = value; } void BytecodeInterpreter::set_locals_float(intptr_t *locals, jfloat value, int offset) { - tag_locals(locals, frame::TagValue, offset); *((jfloat *)&locals[Interpreter::local_index_at(-offset)]) = value; } void BytecodeInterpreter::set_locals_object(intptr_t *locals, oop value, int offset) { - tag_locals(locals, frame::TagReference, offset); *((oop *)&locals[Interpreter::local_index_at(-offset)]) = value; } void BytecodeInterpreter::set_locals_double(intptr_t *locals, jdouble value, int offset) { - tag_locals(locals, frame::TagValue, offset); - tag_locals(locals, frame::TagValue, offset+1); ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->d = value; } void BytecodeInterpreter::set_locals_long(intptr_t *locals, jlong value, int offset) { - tag_locals(locals, frame::TagValue, offset); - tag_locals(locals, frame::TagValue, offset+1); ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->l = value; } void BytecodeInterpreter::set_locals_double_from_addr(intptr_t *locals, address addr, int offset) { - tag_locals(locals, frame::TagValue, offset); - tag_locals(locals, frame::TagValue, offset+1); ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->d = ((VMJavaVal64*)addr)->d; } void BytecodeInterpreter::set_locals_long_from_addr(intptr_t *locals, address addr, int offset) { - tag_locals(locals, frame::TagValue, offset); - tag_locals(locals, frame::TagValue, offset+1); ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->l = ((VMJavaVal64*)addr)->l; } void BytecodeInterpreter::astore(intptr_t* tos, int stack_offset, intptr_t* locals, int locals_offset) { - // Copy tag from stack to locals. astore's operand can be returnAddress - // and may not be TagReference - if (TaggedStackInterpreter) { - frame::Tag t = (frame::Tag) tos[Interpreter::expr_tag_index_at(-stack_offset)]; - locals[Interpreter::local_tag_index_at(-locals_offset)] = (intptr_t)t; - } intptr_t value = tos[Interpreter::expr_index_at(-stack_offset)]; locals[Interpreter::local_index_at(-locals_offset)] = value; } @@ -2912,10 +2834,6 @@ void BytecodeInterpreter::astore(intptr_t* tos, int stack_offset, void BytecodeInterpreter::copy_stack_slot(intptr_t *tos, int from_offset, int to_offset) { - if (TaggedStackInterpreter) { - tos[Interpreter::expr_tag_index_at(-to_offset)] = - (intptr_t)tos[Interpreter::expr_tag_index_at(-from_offset)]; - } tos[Interpreter::expr_index_at(-to_offset)] = (intptr_t)tos[Interpreter::expr_index_at(-from_offset)]; } @@ -2964,16 +2882,9 @@ void BytecodeInterpreter::dup2_x2(intptr_t *tos) { void BytecodeInterpreter::swap(intptr_t *tos) { // swap top two elements intptr_t val = tos[Interpreter::expr_index_at(1)]; - frame::Tag t; - if (TaggedStackInterpreter) { - t = (frame::Tag) tos[Interpreter::expr_tag_index_at(1)]; - } // Copy -2 entry to -1 copy_stack_slot(tos, -2, -1); // Store saved -1 entry into -2 - if (TaggedStackInterpreter) { - tos[Interpreter::expr_tag_index_at(2)] = (intptr_t)t; - } tos[Interpreter::expr_index_at(2)] = val; } // -------------------------------------------------------------------------------- diff --git a/src/share/vm/interpreter/interpreterRuntime.cpp b/src/share/vm/interpreter/interpreterRuntime.cpp index 78a6af554..84d4fd762 100644 --- a/src/share/vm/interpreter/interpreterRuntime.cpp +++ b/src/share/vm/interpreter/interpreterRuntime.cpp @@ -1067,7 +1067,7 @@ IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread, jlong_accessor u; jint* newval = (jint*)value; u.words[0] = newval[0]; - u.words[1] = newval[Interpreter::stackElementWords()]; // skip if tag + u.words[1] = newval[Interpreter::stackElementWords]; // skip if tag fvalue.j = u.long_value; #endif // _LP64 @@ -1252,6 +1252,6 @@ IRT_LEAF(void, InterpreterRuntime::popframe_move_outgoing_args(JavaThread* threa ArgumentSizeComputer asc(invoke->signature()); int size_of_arguments = (asc.size() + (invoke->has_receiver() ? 1 : 0)); // receiver Copy::conjoint_bytes(src_address, dest_address, - size_of_arguments * Interpreter::stackElementSize()); + size_of_arguments * Interpreter::stackElementSize); IRT_END #endif diff --git a/src/share/vm/oops/methodOop.cpp b/src/share/vm/oops/methodOop.cpp index 07ef9a8b9..06825af6c 100644 --- a/src/share/vm/oops/methodOop.cpp +++ b/src/share/vm/oops/methodOop.cpp @@ -306,7 +306,7 @@ void methodOopDesc::cleanup_inline_caches() { int methodOopDesc::extra_stack_words() { // not an inline function, to avoid a header dependency on Interpreter - return extra_stack_entries() * Interpreter::stackElementSize(); + return extra_stack_entries() * Interpreter::stackElementSize; } diff --git a/src/share/vm/prims/methodHandles.hpp b/src/share/vm/prims/methodHandles.hpp index 7e31e0843..fc810b9d6 100644 --- a/src/share/vm/prims/methodHandles.hpp +++ b/src/share/vm/prims/methodHandles.hpp @@ -163,7 +163,7 @@ class MethodHandles: AllStatic { default: ShouldNotReachHere(); } // Return the size of the stack slots to move in bytes. - swap_bytes = swap_slots * Interpreter::stackElementSize(); + swap_bytes = swap_slots * Interpreter::stackElementSize; } static int get_ek_adapter_opt_spread_info(EntryKind ek) { @@ -219,7 +219,7 @@ class MethodHandles: AllStatic { // Offset in words that the interpreter stack pointer moves when an argument is pushed. // The stack_move value must always be a multiple of this. static int stack_move_unit() { - return frame::interpreter_frame_expression_stack_direction() * Interpreter::stackElementWords(); + return frame::interpreter_frame_expression_stack_direction() * Interpreter::stackElementWords; } enum { CONV_VMINFO_SIGN_FLAG = 0x80 }; diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp index 798476145..963b22df5 100644 --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -2867,12 +2867,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) { } #endif // _LP64 - // MethodHandles code does not support TaggedStackInterpreter. - if (EnableMethodHandles && TaggedStackInterpreter) { - warning("TaggedStackInterpreter is not supported by MethodHandles code. Disabling TaggedStackInterpreter."); - TaggedStackInterpreter = false; - } - // Check the GC selections again. if (!check_gc_consistency()) { return JNI_EINVAL; @@ -2915,11 +2909,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) { LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); #endif // CC_INTERP -#ifdef ZERO - // Clear flags not supported by Zero - FLAG_SET_DEFAULT(TaggedStackInterpreter, false); -#endif // ZERO - #ifdef COMPILER2 if (!UseBiasedLocking || EmitSync != 0) { UseOptoBiasInlining = false; diff --git a/src/share/vm/runtime/frame.cpp b/src/share/vm/runtime/frame.cpp index 30782f355..5292bd4be 100644 --- a/src/share/vm/runtime/frame.cpp +++ b/src/share/vm/runtime/frame.cpp @@ -468,42 +468,16 @@ intptr_t* frame::interpreter_frame_local_at(int index) const { return &((*interpreter_frame_locals_addr())[n]); } -frame::Tag frame::interpreter_frame_local_tag(int index) const { - const int n = Interpreter::local_tag_offset_in_bytes(index)/wordSize; - return (Tag)(*interpreter_frame_locals_addr()) [n]; -} - -void frame::interpreter_frame_set_local_tag(int index, Tag tag) const { - const int n = Interpreter::local_tag_offset_in_bytes(index)/wordSize; - (*interpreter_frame_locals_addr())[n] = (intptr_t)tag; -} - intptr_t* frame::interpreter_frame_expression_stack_at(jint offset) const { const int i = offset * interpreter_frame_expression_stack_direction(); - const int n = ((i * Interpreter::stackElementSize()) + - Interpreter::value_offset_in_bytes())/wordSize; + const int n = i * Interpreter::stackElementWords; return &(interpreter_frame_expression_stack()[n]); } -frame::Tag frame::interpreter_frame_expression_stack_tag(jint offset) const { - const int i = offset * interpreter_frame_expression_stack_direction(); - const int n = ((i * Interpreter::stackElementSize()) + - Interpreter::tag_offset_in_bytes())/wordSize; - return (Tag)(interpreter_frame_expression_stack()[n]); -} - -void frame::interpreter_frame_set_expression_stack_tag(jint offset, - Tag tag) const { - const int i = offset * interpreter_frame_expression_stack_direction(); - const int n = ((i * Interpreter::stackElementSize()) + - Interpreter::tag_offset_in_bytes())/wordSize; - interpreter_frame_expression_stack()[n] = (intptr_t)tag; -} - jint frame::interpreter_frame_expression_stack_size() const { // Number of elements on the interpreter expression stack // Callers should span by stackElementWords - int element_size = Interpreter::stackElementWords(); + int element_size = Interpreter::stackElementWords; if (frame::interpreter_frame_expression_stack_direction() < 0) { return (interpreter_frame_expression_stack() - interpreter_frame_tos_address() + 1)/element_size; @@ -585,20 +559,12 @@ void frame::interpreter_frame_print_on(outputStream* st) const { for (i = 0; i < interpreter_frame_method()->max_locals(); i++ ) { intptr_t x = *interpreter_frame_local_at(i); st->print(" - local [" INTPTR_FORMAT "]", x); - if (TaggedStackInterpreter) { - Tag x = interpreter_frame_local_tag(i); - st->print(" - local tag [" INTPTR_FORMAT "]", x); - } st->fill_to(23); st->print_cr("; #%d", i); } for (i = interpreter_frame_expression_stack_size() - 1; i >= 0; --i ) { intptr_t x = *interpreter_frame_expression_stack_at(i); st->print(" - stack [" INTPTR_FORMAT "]", x); - if (TaggedStackInterpreter) { - Tag x = interpreter_frame_expression_stack_tag(i); - st->print(" - stack tag [" INTPTR_FORMAT "]", x); - } st->fill_to(23); st->print_cr("; #%d", i); } @@ -950,103 +916,19 @@ void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool quer } } - if (TaggedStackInterpreter) { - // process locals & expression stack - InterpreterOopMap *mask = NULL; -#ifdef ASSERT - InterpreterOopMap oopmap_mask; - OopMapCache::compute_one_oop_map(m, bci, &oopmap_mask); - mask = &oopmap_mask; -#endif // ASSERT - oops_interpreted_locals_do(f, max_locals, mask); - oops_interpreted_expressions_do(f, signature, has_receiver, - m->max_stack(), - max_locals, mask); - } else { - InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f); - - // process locals & expression stack - InterpreterOopMap mask; - if (query_oop_map_cache) { - m->mask_for(bci, &mask); - } else { - OopMapCache::compute_one_oop_map(m, bci, &mask); - } - mask.iterate_oop(&blk); - } -} - - -void frame::oops_interpreted_locals_do(OopClosure *f, - int max_locals, - InterpreterOopMap *mask) { - // Process locals then interpreter expression stack - for (int i = 0; i < max_locals; i++ ) { - Tag tag = interpreter_frame_local_tag(i); - if (tag == TagReference) { - oop* addr = (oop*) interpreter_frame_local_at(i); - assert((intptr_t*)addr >= sp(), "must be inside the frame"); - f->do_oop(addr); -#ifdef ASSERT - } else { - assert(tag == TagValue, "bad tag value for locals"); - oop* p = (oop*) interpreter_frame_local_at(i); - // Not always true - too bad. May have dead oops without tags in locals. - // assert(*p == NULL || !(*p)->is_oop(), "oop not tagged on interpreter locals"); - assert(*p == NULL || !mask->is_oop(i), "local oop map mismatch"); -#endif // ASSERT - } - } -} - -void frame::oops_interpreted_expressions_do(OopClosure *f, - symbolHandle signature, - bool has_receiver, - int max_stack, - int max_locals, - InterpreterOopMap *mask) { - // There is no stack no matter what the esp is pointing to (native methods - // might look like expression stack is nonempty). - if (max_stack == 0) return; - - // Point the top of the expression stack above arguments to a call so - // arguments aren't gc'ed as both stack values for callee and callee - // arguments in callee's locals. - int args_size = 0; - if (!signature.is_null()) { - args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0); - } + InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f); - intptr_t *tos_addr = interpreter_frame_tos_at(args_size); - assert(args_size != 0 || tos_addr == interpreter_frame_tos_address(), "these are same"); - intptr_t *frst_expr = interpreter_frame_expression_stack_at(0); - // In case of exceptions, the expression stack is invalid and the esp - // will be reset to express this condition. Therefore, we call f only - // if addr is 'inside' the stack (i.e., addr >= esp for Intel). - bool in_stack; - if (interpreter_frame_expression_stack_direction() > 0) { - in_stack = (intptr_t*)frst_expr <= tos_addr; + // process locals & expression stack + InterpreterOopMap mask; + if (query_oop_map_cache) { + m->mask_for(bci, &mask); } else { - in_stack = (intptr_t*)frst_expr >= tos_addr; - } - if (!in_stack) return; - - jint stack_size = interpreter_frame_expression_stack_size() - args_size; - for (int j = 0; j < stack_size; j++) { - Tag tag = interpreter_frame_expression_stack_tag(j); - if (tag == TagReference) { - oop *addr = (oop*) interpreter_frame_expression_stack_at(j); - f->do_oop(addr); -#ifdef ASSERT - } else { - assert(tag == TagValue, "bad tag value for stack element"); - oop *p = (oop*) interpreter_frame_expression_stack_at((j)); - assert(*p == NULL || !mask->is_oop(j+max_locals), "stack oop map mismatch"); -#endif // ASSERT - } + OopMapCache::compute_one_oop_map(m, bci, &mask); } + mask.iterate_oop(&blk); } + void frame::oops_interpreted_arguments_do(symbolHandle signature, bool has_receiver, OopClosure* f) { InterpretedArgumentOopFinder finder(signature, has_receiver, this, f); finder.oops_do(); @@ -1306,29 +1188,18 @@ void frame::zap_dead_interpreted_locals(JavaThread *thread, const RegisterMap* m int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals(); - if (TaggedStackInterpreter) { - InterpreterOopMap *mask = NULL; -#ifdef ASSERT - InterpreterOopMap oopmap_mask; - methodHandle method(thread, m); - OopMapCache::compute_one_oop_map(method, bci, &oopmap_mask); - mask = &oopmap_mask; -#endif // ASSERT - oops_interpreted_locals_do(&_check_oop, max_locals, mask); - } else { - // process dynamic part - InterpreterFrameClosure value_blk(this, max_locals, m->max_stack(), - &_check_value); - InterpreterFrameClosure oop_blk(this, max_locals, m->max_stack(), - &_check_oop ); - InterpreterFrameClosure dead_blk(this, max_locals, m->max_stack(), - &_zap_dead ); - - // get frame map - InterpreterOopMap mask; - m->mask_for(bci, &mask); - mask.iterate_all( &oop_blk, &value_blk, &dead_blk); - } + // process dynamic part + InterpreterFrameClosure value_blk(this, max_locals, m->max_stack(), + &_check_value); + InterpreterFrameClosure oop_blk(this, max_locals, m->max_stack(), + &_check_oop ); + InterpreterFrameClosure dead_blk(this, max_locals, m->max_stack(), + &_zap_dead ); + + // get frame map + InterpreterOopMap mask; + m->mask_for(bci, &mask); + mask.iterate_all( &oop_blk, &value_blk, &dead_blk); } diff --git a/src/share/vm/runtime/frame.hpp b/src/share/vm/runtime/frame.hpp index 92df6b353..ab8084674 100644 --- a/src/share/vm/runtime/frame.hpp +++ b/src/share/vm/runtime/frame.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 @@ -191,26 +191,10 @@ class frame VALUE_OBJ_CLASS_SPEC { intptr_t* interpreter_frame_mdx_addr() const; public: - // Tags for TaggedStackInterpreter - enum Tag { - TagValue = 0, // Important: must be zero to use G0 on sparc. - TagReference = 0x555, // Reference type - is an oop that needs gc. - TagCategory2 = 0x666 // Only used internally by interpreter - // and not written to the java stack. - // The values above are chosen so that misuse causes a crash - // with a recognizable value. - }; - - static Tag tag_for_basic_type(BasicType typ) { - return (typ == T_OBJECT ? TagReference : TagValue); - } - // Locals // The _at version returns a pointer because the address is used for GC. intptr_t* interpreter_frame_local_at(int index) const; - Tag interpreter_frame_local_tag(int index) const; - void interpreter_frame_set_local_tag(int index, Tag tag) const; void interpreter_frame_set_locals(intptr_t* locs); @@ -260,8 +244,6 @@ class frame VALUE_OBJ_CLASS_SPEC { // The _at version returns a pointer because the address is used for GC. intptr_t* interpreter_frame_expression_stack_at(jint offset) const; - Tag interpreter_frame_expression_stack_tag(jint offset) const; - void interpreter_frame_set_expression_stack_tag(jint offset, Tag tag) const; // top of expression stack intptr_t* interpreter_frame_tos_at(jint offset) const; @@ -375,12 +357,6 @@ class frame VALUE_OBJ_CLASS_SPEC { void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true); private: - void oops_interpreted_locals_do(OopClosure *f, - int max_locals, - InterpreterOopMap *mask); - void oops_interpreted_expressions_do(OopClosure *f, symbolHandle signature, - bool has_receiver, int max_stack, int max_locals, - InterpreterOopMap *mask); void oops_interpreted_arguments_do(symbolHandle signature, bool has_receiver, OopClosure* f); // Iteration of oops diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp index 861d89cb6..fd345f913 100644 --- a/src/share/vm/runtime/globals.hpp +++ b/src/share/vm/runtime/globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 @@ -3497,9 +3497,6 @@ class CommandLineFlags { develop(bool, TraceInvokeDynamic, false, \ "trace internal invoke dynamic operations") \ \ - product(bool, TaggedStackInterpreter, false, \ - "Insert tags in interpreter execution stack for oopmap generaion")\ - \ diagnostic(bool, PauseAtStartup, false, \ "Causes the VM to pause at startup time and wait for the pause " \ "file to be removed (default: ./vm.paused.<pid>)") \ diff --git a/src/share/vm/runtime/javaCalls.cpp b/src/share/vm/runtime/javaCalls.cpp index a64fdb07a..0abe94169 100644 --- a/src/share/vm/runtime/javaCalls.cpp +++ b/src/share/vm/runtime/javaCalls.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 @@ -417,17 +417,9 @@ intptr_t* JavaCallArguments::parameters() { // Handle conversion _value[i] = (intptr_t)Handle::raw_resolve((oop *)_value[i]); } - // The parameters are moved to the parameters array to include the tags. - if (TaggedStackInterpreter) { - // Tags are interspersed with arguments. Tags are first. - int tagged_index = i*2; - _parameters[tagged_index] = _is_oop[i] ? frame::TagReference : - frame::TagValue; - _parameters[tagged_index+1] = _value[i]; - } } // Return argument vector - return TaggedStackInterpreter ? _parameters : _value; + return _value; } diff --git a/src/share/vm/runtime/javaCalls.hpp b/src/share/vm/runtime/javaCalls.hpp index 345206f02..2921d5970 100644 --- a/src/share/vm/runtime/javaCalls.hpp +++ b/src/share/vm/runtime/javaCalls.hpp @@ -66,11 +66,9 @@ class JavaCallArguments : public StackObj { }; intptr_t _value_buffer [_default_size + 1]; - intptr_t _parameter_buffer [_default_size*2 + 1]; bool _is_oop_buffer[_default_size + 1]; intptr_t* _value; - intptr_t* _parameters; bool* _is_oop; int _size; int _max_size; @@ -81,7 +79,6 @@ class JavaCallArguments : public StackObj { _value = &_value_buffer[1]; _is_oop = &_is_oop_buffer[1]; - _parameters = &_parameter_buffer[0]; _max_size = _default_size; _size = 0; _start_at_zero = false; @@ -99,11 +96,10 @@ class JavaCallArguments : public StackObj { if (max_size > _default_size) { _value = NEW_RESOURCE_ARRAY(intptr_t, max_size + 1); _is_oop = NEW_RESOURCE_ARRAY(bool, max_size + 1); - if (TaggedStackInterpreter) { - _parameters = NEW_RESOURCE_ARRAY(intptr_t, max_size*2 + 1); - } + // Reserve room for potential receiver in value and is_oop _value++; _is_oop++; + _max_size = max_size; _size = 0; _start_at_zero = false; diff --git a/src/share/vm/runtime/sharedRuntime.cpp b/src/share/vm/runtime/sharedRuntime.cpp index 06af4af32..1b164ab6f 100644 --- a/src/share/vm/runtime/sharedRuntime.cpp +++ b/src/share/vm/runtime/sharedRuntime.cpp @@ -1842,14 +1842,11 @@ class AdapterFingerPrint : public CHeapObj { case T_OBJECT: case T_ARRAY: - if (!TaggedStackInterpreter) { #ifdef _LP64 - return T_LONG; + return T_LONG; #else - return T_INT; + return T_INT; #endif - } - return T_OBJECT; case T_INT: case T_LONG: @@ -2595,17 +2592,9 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) ) // Copy the locals. Order is preserved so that loading of longs works. // Since there's no GC I can copy the oops blindly. assert( sizeof(HeapWord)==sizeof(intptr_t), "fix this code"); - if (TaggedStackInterpreter) { - for (int i = 0; i < max_locals; i++) { - // copy only each local separately to the buffer avoiding the tag - buf[i] = *fr.interpreter_frame_local_at(max_locals-i-1); - } - } else { - Copy::disjoint_words( - (HeapWord*)fr.interpreter_frame_local_at(max_locals-1), + Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1), (HeapWord*)&buf[0], max_locals); - } // Inflate locks. Copy the displaced headers. Be careful, there can be holes. int i = max_locals; diff --git a/src/share/vm/runtime/vframe.cpp b/src/share/vm/runtime/vframe.cpp index 1b5a7f8a0..a4d25b20f 100644 --- a/src/share/vm/runtime/vframe.cpp +++ b/src/share/vm/runtime/vframe.cpp @@ -244,51 +244,30 @@ StackValueCollection* interpretedVFrame::locals() const { StackValueCollection* result = new StackValueCollection(length); // Get oopmap describing oops and int for current bci - if (TaggedStackInterpreter) { - for(int i=0; i < length; i++) { - // Find stack location - intptr_t *addr = locals_addr_at(i); - - // Depending on oop/int put it in the right package - StackValue *sv; - frame::Tag tag = fr().interpreter_frame_local_tag(i); - if (tag == frame::TagReference) { - // oop value - Handle h(*(oop *)addr); - sv = new StackValue(h); - } else { - // integer - sv = new StackValue(*addr); - } - assert(sv != NULL, "sanity check"); - result->add(sv); - } + InterpreterOopMap oop_mask; + if (TraceDeoptimization && Verbose) { + methodHandle m_h(thread(), method()); + OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); } else { - InterpreterOopMap oop_mask; - if (TraceDeoptimization && Verbose) { - methodHandle m_h(thread(), method()); - OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); + method()->mask_for(bci(), &oop_mask); + } + // handle locals + for(int i=0; i < length; i++) { + // Find stack location + intptr_t *addr = locals_addr_at(i); + + // Depending on oop/int put it in the right package + StackValue *sv; + if (oop_mask.is_oop(i)) { + // oop value + Handle h(*(oop *)addr); + sv = new StackValue(h); } else { - method()->mask_for(bci(), &oop_mask); - } - // handle locals - for(int i=0; i < length; i++) { - // Find stack location - intptr_t *addr = locals_addr_at(i); - - // Depending on oop/int put it in the right package - StackValue *sv; - if (oop_mask.is_oop(i)) { - // oop value - Handle h(*(oop *)addr); - sv = new StackValue(h); - } else { - // integer - sv = new StackValue(*addr); - } - assert(sv != NULL, "sanity check"); - result->add(sv); + // integer + sv = new StackValue(*addr); } + assert(sv != NULL, "sanity check"); + result->add(sv); } return result; } @@ -331,53 +310,31 @@ StackValueCollection* interpretedVFrame::expressions() const { int nof_locals = method()->max_locals(); StackValueCollection* result = new StackValueCollection(length); - if (TaggedStackInterpreter) { - // handle expressions - for(int i=0; i < length; i++) { - // Find stack location - intptr_t *addr = fr().interpreter_frame_expression_stack_at(i); - frame::Tag tag = fr().interpreter_frame_expression_stack_tag(i); - - // Depending on oop/int put it in the right package - StackValue *sv; - if (tag == frame::TagReference) { - // oop value - Handle h(*(oop *)addr); - sv = new StackValue(h); - } else { - // otherwise - sv = new StackValue(*addr); - } - assert(sv != NULL, "sanity check"); - result->add(sv); - } + InterpreterOopMap oop_mask; + // Get oopmap describing oops and int for current bci + if (TraceDeoptimization && Verbose) { + methodHandle m_h(method()); + OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); } else { - InterpreterOopMap oop_mask; - // Get oopmap describing oops and int for current bci - if (TraceDeoptimization && Verbose) { - methodHandle m_h(method()); - OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); + method()->mask_for(bci(), &oop_mask); + } + // handle expressions + for(int i=0; i < length; i++) { + // Find stack location + intptr_t *addr = fr().interpreter_frame_expression_stack_at(i); + + // Depending on oop/int put it in the right package + StackValue *sv; + if (oop_mask.is_oop(i + nof_locals)) { + // oop value + Handle h(*(oop *)addr); + sv = new StackValue(h); } else { - method()->mask_for(bci(), &oop_mask); - } - // handle expressions - for(int i=0; i < length; i++) { - // Find stack location - intptr_t *addr = fr().interpreter_frame_expression_stack_at(i); - - // Depending on oop/int put it in the right package - StackValue *sv; - if (oop_mask.is_oop(i + nof_locals)) { - // oop value - Handle h(*(oop *)addr); - sv = new StackValue(h); - } else { - // integer - sv = new StackValue(*addr); - } - assert(sv != NULL, "sanity check"); - result->add(sv); + // integer + sv = new StackValue(*addr); } + assert(sv != NULL, "sanity check"); + result->add(sv); } return result; } diff --git a/src/share/vm/runtime/vframeArray.cpp b/src/share/vm/runtime/vframeArray.cpp index 2fb27dfd9..f76b9e2c6 100644 --- a/src/share/vm/runtime/vframeArray.cpp +++ b/src/share/vm/runtime/vframeArray.cpp @@ -309,11 +309,6 @@ void vframeArrayElement::unpack_on_stack(int callee_parameters, default: ShouldNotReachHere(); } - if (TaggedStackInterpreter) { - // Write tag to the stack - iframe()->interpreter_frame_set_expression_stack_tag(i, - frame::tag_for_basic_type(value->type())); - } } @@ -335,11 +330,6 @@ void vframeArrayElement::unpack_on_stack(int callee_parameters, default: ShouldNotReachHere(); } - if (TaggedStackInterpreter) { - // Write tag to stack - iframe()->interpreter_frame_set_local_tag(i, - frame::tag_for_basic_type(value->type())); - } } if (is_top_frame && JvmtiExport::can_pop_frame() && thread->popframe_forcing_deopt_reexecution()) { @@ -354,9 +344,8 @@ void vframeArrayElement::unpack_on_stack(int callee_parameters, void* saved_args = thread->popframe_preserved_args(); assert(saved_args != NULL, "must have been saved by interpreter"); #ifdef ASSERT - int stack_words = Interpreter::stackElementWords(); assert(popframe_preserved_args_size_in_words <= - iframe()->interpreter_frame_expression_stack_size()*stack_words, + iframe()->interpreter_frame_expression_stack_size()*Interpreter::stackElementWords, "expression stack size should have been extended"); #endif // ASSERT int top_element = iframe()->interpreter_frame_expression_stack_size()-1; |