Hello Mike and Eliot,
Since I'm working on a distributed version of the JikesRVM using the
home-based lazy release consistency protocol, I somehow need to map each
object allocated by the user application and also some VM object like
VM_Class, etc. against a globally unique identifier.
The ID consists of the id of the node and a number. Everytime an object
is allocated on a node, it will be broadcasted to the other nodes. If a
thread on node 1 accesses an object allocated on node 2, it is clear
from the globally unique id where to request the object.
It is therefore not sufficient to store the information in the object's
header.
Cheers,
Ken
Michael Bond schrieb:
> Hi Ken,
>
> I agree with Eliot that there's probably a better way to do what you're
> trying to do. Could you explain the type of information you want to store
> for each object?
>
> If you'd like to store info for each allocated object, you could store it
> in the object's header. See VM_MiscHeader for how to add a word or words
> to each object's header. Instrumentation at each allocation could then
> write to the extra word(s) in the header.
>
> cheers,
> Mike
>
> On Fri, 25 Apr 2008, Ken Lee wrote:
>
>
>>Hi Mike,
>>
>>Thanks for your reply.
>>
>>After having inserted the line
>>
>>Ljava/util/TreeMap;
>>
>>in the RVM.txt file, I can see that the methods are included in the boot
>>image by inspecting the RVM.map file.
>>
>>As you stated below regarding the recursive infinite loop, I suspected
>>the same yesterday when I allocated a Foo object (the TreeMap should
>>contain <Foo, Object>) with "new" in the resolvedNewScalar method. The
>>exception that occurs was also a recursive infinite loop exception.
>>I therefore used the MM_Interface.allocateScalar method to allocate the
>>object which then worked. I assume that the TreeMap implementation
>>allocates internal Node objects with the keyword "new" which then also
>>leads to a recursive infinite loop.
>>
>>
>>JikesRVM: internal error: recursive use of hardware exception registers
>>(exiting)
>>
>>-- Stack --
>>at [0x57c169f0] Ljava/util/TreeMap;
>>put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; at line 531
>>at [0x57c16a4c] Lorg/jikesrvm/runtime/VM_Runtime;
>>resolvedNewScalar(I[Ljava/lang/Object;ZIIII)Ljava/lang/Object; at line 426
>>at [0x57c16a98] Ljava/util/TreeMap;
>>put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; at line 531
>>at [0x57c16af4] Lorg/jikesrvm/runtime/VM_Runtime;
>>resolvedNewScalar(I[Ljava/lang/Object;ZIIII)Ljava/lang/Object; at line 426
>>...
>>Segmentation fault (core dumped)
>>
>>A solution could be to provide another TreeMap implementation which uses
>>the MM_Interface to allocate Node objects instead of using the keyword
>>"new".
>>What do you think?
>>
>>Cheers,
>>
>>Ken
>>
>>Michael Bond wrote:
>>
>>>Hi Ken,
>>>
>>>Sorry for the delayed response. It's possible that TreeMap isn't being
>>>included in the bootimage. You could look in $RVM_ROOT/dist/*/RVM.map to
>>>see if there are TreeMap methods being included in the boot image.
>>>
>>>Calling TreeMap methods at each allocation seems problematic.
>>>TreeMap.put() will allocate objects in order to build/grow the tree
>>>structure, so it seems the code would end up in a recursive infinite loop.
>>>Hmm, you could probably avoid a recursive infinite loop by checking and
>>>setting a flag during the call. Maybe you've considered this.
>>>
>>>Could you print full error you're getting from the VM on startup?
>>>
>>>cheers,
>>>Mike
>>>
>>>On Fri, 18 Apr 2008, Ken Lee wrote:
>>>
>>>
>>>
>>>>Hi Mike
>>>>
>>>>Thanks for your information. The code for the write barrier was more or
>>>>less exactly that I was looking for (for executing code written in Java
>>>>in the VM_Assembler).
>>>>
>>>>I still have some problems as far as the bootimage is concerned. For
>>>>example, I would like to map created every object against a number in a
>>>>TreeMap. For this purpose I would like to introduce a class Foo
>>>>containing a static field TreeMap<Integer, Object>. Whenever an object
>>>>is created I would like to insert this object into this map (in VM_Runtime)
>>>>As far as I understand I have to add the TreeMap class into the
>>>>bootimage such that the class is known when the JikesRVM is booted and
>>>>annotate the static field in the Foo class as an @Entrypoint and add it
>>>>in the VM_Entrypoint class.
>>>>
>>>>The problem I have is that the JikesRVM still won't startup. I suspect
>>>>that the TreeMap is not in the bootimage and upon a call to "new" the
>>>>object cannot be inserted into the map since it is not instantiate at
>>>>that time. Or do I misunderstand something?
>>>>
>>>>Cheers,
>>>>
>>>>Ken
>>>>
>>>>
>>>>Michael Bond wrote:
>>>>
>>>>
>>>>>Hi Ken,
>>>>>
>>>>>On Thu, 10 Apr 2008, Ken Lee wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>I've got a few questions related to the baseline compiler (for IA32) and
>>>>>>the bootimage. For my project I'm working on I need to extend the
>>>>>>baseline compiler at a first step to do some additional checks whenever
>>>>>>a field is accessed and there might be a call to the method bar() of a
>>>>>>custom class foo. In my opinion there are 2 ways to do that, but I'm not
>>>>>>sure if the second one really works:
>>>>>>
>>>>>>1. If we look in the VM_Compiler for the IA32 architecture, I could add
>>>>>>some additional assembly codes in the emit methods for getfield. In the
>>>>>>assembly code to call a method written in a Java class I need to build
>>>>>>that class into the bootimage such that the address of the method bar()
>>>>>>is known to the assembler to link. As far as I understand the JikesRVM
>>>>>>userguide there are primordial classes which are always built into the
>>>>>>bootimage. I added the line
>>>>>>
>>>>>>[Lorg/jikesrvm/mypackage/foo
>>>>>>
>>>>>>in the file RVM.txt. But after building the image with the simplest
>>>>>>configuration of BaseBaseNoGC, the class foo is not listed in the
>>>>>>BootImageWriterOutput file.
>>>>>>Even executing the parameters "-Dconfig.include.all-classes=true
>>>>>>-Dconfig.bootimage.compiler=opt", which should include all classes in
>>>>>>the bootimage, didn't help. Any suggestions what I'm doing wrong?
>>>>>>
>>>>>>
>>>>>
>>>>>The syntax in the line above is for an *array* of foo objects. I'm
>>>>>guessing you just need the foo class included in the boot image; to do
>>>>>this, just remove the bracket ([) from the beginning of the line. Also, I
>>>>>think you need (1) a semicolon (;) after the name of the class and a (2)
>>>>>an end-of-line after it (i.e., the line shouldn't be the last line in
>>>>>RVM.txt, which should end with an empty line).
>>>>>
>>>>>Note: usually when adding a new class to Jikes, you don't need to add an
>>>>>entry in RVM.txt since the class will be accessed by other Jikes classes
>>>>>and be included automatically.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>2. This only works if it is possible in the Java code to access the
>>>>>>registers and/or the stack. For example in the emit_resolved_getfield()
>>>>>>method after the line
>>>>>>
>>>>>>asm.emitMOV_Reg_RegDisp(T0, S0, fieldOffset); // T0 is field value
>>>>>>
>>>>>>It would be comfortable to get the value in the register T0 and then do
>>>>>>the checks and the call to the method bar() in the Java code instead in
>>>>>>assembly language, which is much more convenient but should reduce the
>>>>>>performance since the method call is translated the via emit_invoke anyway.
>>>>>>But is it possible to fetch a register value in the Java code?
>>>>>>
>>>>>>
>>>>>
>>>>>It sounds like you're trying to implement read barriers (instrumentation
>>>>>at every getfield and usually also at array element loads). I'd suggest
>>>>>first checking out the code for write barriers (instrumentation at every
>>>>>putfield and array element store) in the methods emit_resolved_putfield(),
>>>>>emit_unresolved_putfield(), and emit_aastore(). The code for read
>>>>>barriers will be very similar. Alternatively, I believe the SVN trunk now
>>>>>has full read barrier support, implemented by Daniel Frampton.
>>>>>
>>>>>hope that helps,
>>>>>Mike
>>>>>
>>>>>-------------------------------------------------------------------------
>>>>>This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>>>>>Don't miss this year's exciting event. There's still time to save $100.
>>>>>Use priority code J8TL2D2.
>>>>>http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>>>>>_______________________________________________
>>>>>Jikesrvm-researchers mailing list
>>>>>Jikesrvm-researchers@...
>>>>>https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>>>>>
>>>>>
>>>>
>>>>-------------------------------------------------------------------------
>>>>This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>>>>Don't miss this year's exciting event. There's still time to save $100.
>>>>Use priority code J8TL2D2.
>>>>http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>>>>_______________________________________________
>>>>Jikesrvm-researchers mailing list
>>>>Jikesrvm-researchers@...
>>>>https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>>>>
>>>>
>>>
>>>-------------------------------------------------------------------------
>>>This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>>>Don't miss this year's exciting event. There's still time to save $100.
>>>Use priority code J8TL2D2.
>>>http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>>>_______________________________________________
>>>Jikesrvm-researchers mailing list
>>>Jikesrvm-researchers@...
>>>https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>>>
>>
>>
>>-------------------------------------------------------------------------
>>This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>>Don't miss this year's exciting event. There's still time to save $100.
>>Use priority code J8TL2D2.
>>http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>>_______________________________________________
>>Jikesrvm-researchers mailing list
>>Jikesrvm-researchers@...
>>https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Jikesrvm-researchers mailing list
> Jikesrvm-researchers@...
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>
|