You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/07/06 16:02:51 UTC

svn commit: r419557 - in /incubator/harmony/enhanced/drlvm/trunk/vm: interpreter/src/interpreter.cpp vmcore/src/init/vm.cpp vmcore/src/jit/jit_runtime_support.cpp vmcore/src/verifier/Verifier.cpp

Author: geirm
Date: Thu Jul  6 07:02:51 2006
New Revision: 419557

URL: http://svn.apache.org/viewvc?rev=419557&view=rev
Log:
HARMONY-677 

minimal 1.5 class support - DRLVM can handle v49 classfiles


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp?rev=419557&r1=419556&r2=419557&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp Thu Jul  6 07:02:51 2006
@@ -13,10 +13,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Ivan Volosyuk
- * @version $Revision: 1.61.4.15.4.4 $
- */  
 #include "interpreter.h"
 #include "interpreter_exports.h"
 #include "interpreter_imports.h"
@@ -955,18 +951,22 @@
 
 #ifndef NDEBUG
     switch(cp_tag(cp, index)) {
-        case 8:
+        case CONSTANT_String:
             DEBUG_BYTECODE("#" << dec << (int)index << " String: \"" << cp[index].CONSTANT_String.string->bytes << "\"");
             break;
-        case 3:
+        case CONSTANT_Integer:
             DEBUG_BYTECODE("#" << dec << (int)index << " Integer: " << (int)cp[index].int_value);
             break;
-        case 4:
+        case CONSTANT_Float:
             DEBUG_BYTECODE("#" << dec << (int)index << " Float: " << cp[index].float_value);
             break;
+        case CONSTANT_Class:
+            DEBUG_BYTECODE("#" << dec << (int)index << " Class: \"" << const_pool_get_class_name(clazz, index) << "\"");
+            break;
         default:
             DEBUG_BYTECODE("#" << dec << (int)index << " Unknown type = " << cp_tag(cp, index));
-            ABORT("Unknown type");
+            DIE("ldc instruction: unexpected type (" << cp_tag(cp, index) 
+                << ") of constant pool entry [" << index << "]");
             break;
     }
 #endif
@@ -979,6 +979,19 @@
         // FIXME: only compressed references
         frame.stack.pick().cr = COMPRESS_REF(vm_instantiate_cp_string_resolved(str));
         frame.stack.ref() = FLAG_OBJECT;
+        return !exn_raised();
+    } 
+    else if (cp_is_class(cp, index)) 
+    {
+        Class *other_class = interp_resolve_class(clazz, index);
+        if (!other_class) {
+             return false;
+        }
+        assert(!tmn_is_suspend_enabled());
+        
+        frame.stack.pick().cr = COMPRESS_REF(*(other_class->class_handle));
+        frame.stack.ref() = FLAG_OBJECT;
+        
         return !exn_raised();
     }
     

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp?rev=419557&r1=419556&r2=419557&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp Thu Jul  6 07:02:51 2006
@@ -115,25 +115,25 @@
 
 
 // A run-time error occurs if called for an index which does not represent
-// a constant of type String, Integer, Float, Long or Double.
+// a constant of type Class, String, Integer, Float, Long or Double.
 Java_Type class_get_cp_const_type(Class *clss, unsigned cp_index)
 {
     Const_Pool *cp = clss->const_pool;
-    assert(cp_is_constant(cp, cp_index));
     switch(cp_tag(cp, cp_index)) {
     case CONSTANT_String:
         return JAVA_TYPE_STRING;
     case CONSTANT_Integer:
-            return JAVA_TYPE_INT;
+        return JAVA_TYPE_INT;
     case CONSTANT_Float:
-            return JAVA_TYPE_FLOAT;
+        return JAVA_TYPE_FLOAT;
     case CONSTANT_Long:
-            return JAVA_TYPE_LONG;
+        return JAVA_TYPE_LONG;
     case CONSTANT_Double:
-            return JAVA_TYPE_DOUBLE;
-    
+        return JAVA_TYPE_DOUBLE;
+    case CONSTANT_Class:
+        return JAVA_TYPE_CLASS;
     default:
-        DIE("unknown constant type in classfile");
+        DIE("non-constant type is requested from constant pool : " << cp_tag(cp, cp_index));
     }
     return JAVA_TYPE_INVALID;
 } //class_get_cp_const_type

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp?rev=419557&r1=419556&r2=419557&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp Thu Jul  6 07:02:51 2006
@@ -154,14 +154,40 @@
 }
 
 ///////////////////////////////////////////////////////////
-// Load Constant String
+// Load Constant String or Class
 
-static NativeCodePtr rth_get_lil_ldc_string(int* dyn_count)
+static ManagedObject * rth_ldc_ref_helper(Class *c, unsigned cp_index) 
+    {
+    Const_Pool *cp = c->const_pool;
+    if (cp_is_string(cp, cp_index)) 
+    {
+        return vm_instantiate_cp_string_slow(c, cp_index);
+    } 
+    else if (cp_is_class(cp, cp_index)) 
+    {
+        assert(!tmn_is_suspend_enabled());
+        tmn_suspend_enable();
+        Class *objClass = class_resolve_class(c, cp_index); 
+        tmn_suspend_disable();
+        if (objClass) {
+            return struct_Class_to_java_lang_Class(objClass);
+        }
+        if (!exn_raised()) {
+            class_throw_linking_error(c, cp_index, 0);
+        } else {
+            exn_throw(exn_get());
+        }
+    }
+    exn_throw_by_name("java/lang/InternalError", "Unsupported ldc argument");
+    return NULL;
+}
+
+static NativeCodePtr rth_get_lil_ldc_ref(int* dyn_count)
 {
     static NativeCodePtr addr = NULL;
 
     if (!addr) {
-        ManagedObject* (*p_instantiate_string)(Class*,unsigned) = vm_instantiate_cp_string_slow;
+        ManagedObject* (*p_instantiate_ref)(Class*,unsigned) = rth_ldc_ref_helper;
         LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:g4,pint:ref;");
         assert(cs);
         if (dyn_count) {
@@ -176,9 +202,9 @@
             "call %0i;"
             "pop_m2n;"
             "ret;",
-            p_instantiate_string);
+            p_instantiate_ref);
         assert(cs && lil_is_valid(cs));
-        addr = LilCodeGenerator::get_platform()->compile(cs, "rth_ldc_string", dump_stubs);
+        addr = LilCodeGenerator::get_platform()->compile(cs, "rth_ldc_ref", dump_stubs);
         lil_free_code_stub(cs);
     }
 
@@ -1665,7 +1691,7 @@
     case VM_RT_MULTIANEWARRAY_RESOLVED:
         return rth_get_lil_multianewarray(dyn_count);
     case VM_RT_LDC_STRING:
-        return rth_get_lil_ldc_string(dyn_count);
+        return rth_get_lil_ldc_ref(dyn_count);
         // Exceptions
     case VM_RT_THROW:
     case VM_RT_THROW_SET_STACK_TRACE:

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp?rev=419557&r1=419556&r2=419557&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp Thu Jul  6 07:02:51 2006
@@ -1747,12 +1747,16 @@
         type = ctex->m_type->NewType( "Ljava/lang/String", 17 );
         vf_set_vector_stack_entry_ref( cp_parse->field.f_vector, 0, type );
         break;
+	case _CONSTANT_Class:
+        type = ctex->m_type->NewType( "Ljava/lang/Class", 16 );
+        vf_set_vector_stack_entry_ref( cp_parse->field.f_vector, 0, type );
+		break;
     default:
         VERIFY_REPORT( ctex, "(class: " << class_get_name( ctex->m_class )
             << ", method: " << method_get_name( ctex->m_method )
             << method_get_descriptor( ctex->m_method )
             << ") Illegal type in constant pool,"
-            << index << ": CONSTANT_Integer, CONSTANT_Float or CONSTANT_String are expected" );
+            << index << ": CONSTANT_Integer, CONSTANT_Float, CONSTANT_String or CONSTANT_Class are expected" );
         return VER_ErrorConstantPool;
     }
     return VER_OK;



Re: svn commit: r419557 - in /incubator/harmony/enhanced/drlvm/trunk/vm: interpreter/src/interpreter.cpp vmcore/src/init/vm.cpp vmcore/src/jit/jit_runtime_support.cpp vmcore/src/verifier/Verifier.cpp

Posted by Ivan Volosyuk <iv...@gmail.com>.
Anyway, I want to make a few changes in interpreter code. There is a
fix for a few floating-point to integer conversions' bytecodes which
make incorrect clumping. An improvement for diagnostic messages in
AbstractMethodError and IllegalAccessError. Is it the right time to do
this kind of changes?

On 7/6/06, Ivan Volosyuk <iv...@gmail.com> wrote:
> On 7/6/06, Mark Hindess <ma...@googlemail.com> wrote:
..........

> Btw, I have a few bug fixes. Shell I post it to harmony-dev for
> discussion or just submit its to JIRA?
> --
> Ivan
>

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: author tags

Posted by Weldon Washburn <we...@gmail.com>.
+1 in favor of dumping author tags.

On 7/6/06, Geir Magnusson Jr <ge...@pobox.com> wrote:
> please categorize subject lines...
>
> Tim Ellison wrote:
> > Ivan Volosyuk wrote:
> >> A little bit upset, that I'm no longer mentioned as author of the
> >> interpreter.cpp, it was quite a bit of work; not perfect I know.
> >
> > Sorry that you feel that way.  Your feelings illustrates to me why it is
> > easier and arguably fairer to never have author tags.  The intent is not
> > to upset people by omitting some names and not others, or getting into
> > debates about whether a JavaDoc spelling correction warrants authorship,
> > etc.
> >
> > I understand that others have opposing opinions, and I don't feel
> > strongly about it.
> >
> > Regards,
> > Tim
> >
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Weldon Washburn
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: author tags

Posted by Geir Magnusson Jr <ge...@pobox.com>.
please categorize subject lines...

Tim Ellison wrote:
> Ivan Volosyuk wrote:
>> A little bit upset, that I'm no longer mentioned as author of the
>> interpreter.cpp, it was quite a bit of work; not perfect I know.
> 
> Sorry that you feel that way.  Your feelings illustrates to me why it is
> easier and arguably fairer to never have author tags.  The intent is not
> to upset people by omitting some names and not others, or getting into
> debates about whether a JavaDoc spelling correction warrants authorship,
> etc.
> 
> I understand that others have opposing opinions, and I don't feel
> strongly about it.
> 
> Regards,
> Tim
> 

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


author tags (was: Re: svn commit: r419557 - in /incubator/harmony/enhanced/drlvm/trunk/vm: interpreter/src/interpreter.cpp vmcore/src/init/vm.cpp vmcore/src/jit/jit_runtime_support.cpp vmcore/src/verifier/Verifier.cpp)

Posted by Tim Ellison <t....@gmail.com>.
Ivan Volosyuk wrote:
> A little bit upset, that I'm no longer mentioned as author of the
> interpreter.cpp, it was quite a bit of work; not perfect I know.

Sorry that you feel that way.  Your feelings illustrates to me why it is
easier and arguably fairer to never have author tags.  The intent is not
to upset people by omitting some names and not others, or getting into
debates about whether a JavaDoc spelling correction warrants authorship,
etc.

I understand that others have opposing opinions, and I don't feel
strongly about it.

Regards,
Tim

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: svn commit: r419557 - in /incubator/harmony/enhanced/drlvm/trunk/vm: interpreter/src/interpreter.cpp vmcore/src/init/vm.cpp vmcore/src/jit/jit_runtime_support.cpp vmcore/src/verifier/Verifier.cpp

Posted by Ivan Volosyuk <iv...@gmail.com>.
On 7/6/06, Mark Hindess <ma...@googlemail.com> wrote:
>
> On 6 July 2006 at 10:36, Geir Magnusson Jr <ge...@pobox.com> wrote:
>
> > Ivan Volosyuk wrote:
> >
> > > It is good to see that we finally have java1.5 support in
> > > DRLVM.  One small question, why my authorship was discarded from
> > > interpreter.cpp? :)
> >
> > Nothing personal - just a habit...  I'm just nipping off author tags
> > as I go along ...
>
> Didn't this used to be ASF policy?  I thought I recall hearing (at
> ApacheCon) that this had changed and that authorship tags were now
> allowed.
>
> > ... as this code belongs to all of us.
>
> Agreed.
>
> > Maybe it's time to revisit this - does anyone really want them?
>
> Personally, no.  I don't like them.  If you put one name in then
> everyone who edits it should be entitled to add their name and that just
> gets out of hand.

There authors tags was quite useful in DRLVM development to find
person responsible for certain component or source file. If it was
difficult to fix a bug or implement some feature related to some
subcomponent I usually contacted the author of a file to do the job or
to help me get through.
May be it doesn't makes sense in the open community like harmony.

A little bit upset, that I'm no longer mentioned as author of the
interpreter.cpp, it was quite a bit of work; not perfect I know.

Btw, I have a few bug fixes. Shell I post it to harmony-dev for
discussion or just submit its to JIRA?
--
Ivan

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: svn commit: r419557 - in /incubator/harmony/enhanced/drlvm/trunk/vm: interpreter/src/interpreter.cpp vmcore/src/init/vm.cpp vmcore/src/jit/jit_runtime_support.cpp vmcore/src/verifier/Verifier.cpp

Posted by Geir Magnusson Jr <ge...@pobox.com>.
Nothing personal - just a habit...  I'm just nipping off author tags as
I go along as this code belongs to all of us.

Maybe it's time to revisit this - does anyone really want them?

geir


Ivan Volosyuk wrote:
> It is good to see that we finally have java1.5 support in DRLVM.
> One small question, why my authorship was discarded from
> interpreter.cpp? :)
> -- 
> Ivan
> 
> On 7/6/06, geirm@apache.org <ge...@apache.org> wrote:
>> Author: geirm
>> Date: Thu Jul  6 07:02:51 2006
>> New Revision: 419557
>>
>> URL: http://svn.apache.org/viewvc?rev=419557&view=rev
>> Log:
>> HARMONY-677
>>
>> minimal 1.5 class support - DRLVM can handle v49 classfiles
>>
>>
>> Modified:
>>    
>> incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
>>     incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp
>>    
>> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
>>
>>    
>> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp
>>
>>
>> Modified:
>> incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
>> URL:
>> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp?rev=419557&r1=419556&r2=419557&view=diff
>>
>> ==============================================================================
>>
>> ---
>> incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
>> (original)
>> +++
>> incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
>> Thu Jul  6 07:02:51 2006
>> @@ -13,10 +13,6 @@
>>   *  See the License for the specific language governing permissions and
>>   *  limitations under the License.
>>   */
>> -/**
>> - * @author Ivan Volosyuk
>> - * @version $Revision: 1.61.4.15.4.4 $
>> - */
>>  #include "interpreter.h"
>>  #include "interpreter_exports.h"
>>  #include "interpreter_imports.h"
>> @@ -955,18 +951,22 @@
>>
>>  #ifndef NDEBUG
>>      switch(cp_tag(cp, index)) {
>> -        case 8:
>> +        case CONSTANT_String:
>>              DEBUG_BYTECODE("#" << dec << (int)index << " String: \""
>> << cp[index].CONSTANT_String.string->bytes << "\"");
>>              break;
> 
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> 
> 
> 

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: svn commit: r419557 - in /incubator/harmony/enhanced/drlvm/trunk/vm: interpreter/src/interpreter.cpp vmcore/src/init/vm.cpp vmcore/src/jit/jit_runtime_support.cpp vmcore/src/verifier/Verifier.cpp

Posted by Ivan Volosyuk <iv...@gmail.com>.
It is good to see that we finally have java1.5 support in DRLVM.
One small question, why my authorship was discarded from interpreter.cpp? :)
--
Ivan

On 7/6/06, geirm@apache.org <ge...@apache.org> wrote:
> Author: geirm
> Date: Thu Jul  6 07:02:51 2006
> New Revision: 419557
>
> URL: http://svn.apache.org/viewvc?rev=419557&view=rev
> Log:
> HARMONY-677
>
> minimal 1.5 class support - DRLVM can handle v49 classfiles
>
>
> Modified:
>     incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
>     incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm.cpp
>     incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
>     incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp
>
> Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
> URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp?rev=419557&r1=419556&r2=419557&view=diff
> ==============================================================================
> --- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp (original)
> +++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp Thu Jul  6 07:02:51 2006
> @@ -13,10 +13,6 @@
>   *  See the License for the specific language governing permissions and
>   *  limitations under the License.
>   */
> -/**
> - * @author Ivan Volosyuk
> - * @version $Revision: 1.61.4.15.4.4 $
> - */
>  #include "interpreter.h"
>  #include "interpreter_exports.h"
>  #include "interpreter_imports.h"
> @@ -955,18 +951,22 @@
>
>  #ifndef NDEBUG
>      switch(cp_tag(cp, index)) {
> -        case 8:
> +        case CONSTANT_String:
>              DEBUG_BYTECODE("#" << dec << (int)index << " String: \"" << cp[index].CONSTANT_String.string->bytes << "\"");
>              break;

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org