« Return to Thread: [rvm-research] to utilize methods in syscall

Re: [rvm-research] to utilize methods in syscall

by Robin Garner :: Rate this Message:

Reply to Author | View in Thread

Liangliang Tong wrote:

> Dear Robin,
>
> Thanks for your reply.
> I am just taking sysMalloc as an example, the actual method I called is
> another custom allocation function implemented by myself. This function
> applies special characteristics to the allocated memory chunk, which I
> hope to use as a nursery space. Rawpagespace does not help.
> In this case, what am I supposed to do in order to achieve my target?
> Thanks.
>  
I'm not sure I understand what your target is - perhaps you could use a
better example ?

I've outlined the steps you need to follow in order to make an arbitrary
syscall (and for more details, follow a method like 'dzmmap' through the
interface).

If you want to implement a new allocator (at the object level), then
what you want to do is sub-class Space and Allocator for the global and
thread-local components of the allocator.  If you want to change how a
Space acquires pages from the OS, then you should create a new
PageResource and define or modify a sub-class of Space that uses it.

If you need more explanation, please tell us in more detail what it is
you're trying to do.

Regards,
Robin

> Regards,
> Liangliang
>
> Robin Garner wrote:
>  
>> Liangliang Tong wrote:
>>  
>>    
>>> Dear all,
>>>
>>> In org.mmtk.plan.generational.Gen.java, I want to modify the vmRequest
>>> to request for an explicit region of memory, like the following:
>>>    private static final VMRequest vmRequest =
>>> VMRequest.create(sysCall.sysMalloc(1 << 20),  Extent.fromIntSignExtend(1
>>> << 20));
>>> correspondingly I add a new import statement:
>>>  import static org.jikesrvm.runtime.SysCall.sysCall;
>>>
>>> Yet when I complied the generational copy plan, it prompts these errors:
>>> compile-mmtk:
>>>     [javac] Compiling 1 source file to
>>> /home/lltong/jikesrvm/target/mmtk/classes
>>>     [javac]
>>> /home/lltong/jikesrvm/MMTk/src/org/mmtk/plan/crgenerational/CRGen.java:33:
>>> package org.jikesrvm.runtime does not exist
>>>     [javac] import static org.jikesrvm.runtime.SysCall.sysCall;
>>>     [javac]                                   ^
>>>     [javac]
>>> /home/lltong/jikesrvm/MMTk/src/org/mmtk/plan/crgenerational/CRGen.java:33:
>>> static import only from classes and interfaces
>>>     [javac] import static org.jikesrvm.runtime.SysCall.sysCall;
>>>     [javac] ^
>>>     [javac]
>>> /home/lltong/jikesrvm/MMTk/src/org/mmtk/plan/crgenerational/CRGen.java:91:
>>> cannot find symbol
>>>     [javac] symbol  : variable sysCall
>>>     [javac] location: class org.mmtk.plan.crgenerational.CRGen
>>>
>>> Why should this happen? Thanks in advance.
>>>
>>>  
>>>    
>>>      
>> Hi Liangliang,
>>
>> As far as I can see, you are trying to request a 1MB chunk of memory,
>> and you don't care where in the heap it is.  Is this right ?
>>
>>
>> MMTk uses the 'Space' class to abstract over various ways to allocate
>> memory.  If you simply want a 1MB chunk of raw memory, then you can do
>>
>>   RawPageSpace mySpace = new RawPageSpace("mySpace", Integer.MAX_VALUE,
>> VMRequest.create());
>>   Address chunkAddr = mySpace.acquire(1<<(20-LOG_BYTES_IN_PAGE));
>>
>> If you're using memory as storage for your collector, you should
>> probably allocate it in the existing metaDataSpace.  If you're
>> allocating it to give to the mutator, you should probably define a new
>> space for it.
>>
>> Note that a VMRequest is simply a way to communicate your virtual memory
>> layout requirements to the Space class, and passing it a chunk of
>> 'malloc'ed memory doesn't make a great deal of sense.  In fact MMTk
>> itself generally takes the place of 'malloc' in the virtual machine.
>>
>>
>> The reason you can't directly call sysMalloc from MMTk is that MMTk
>> separates itself from JikesRVM (and its various other host environments)
>> via the org.mmtk.vm package (the VM interface).  In order to call a new
>> method on the JikesRVM side of the fence you need to:
>>
>> - Choose an interface class to host the method (eg org.mmtk.vm.Memory)
>> - Add an abstract method to the interface class
>> - Add a concrete method to the implementation on the VM side of the
>> fence (for JikesRVM that is org.jikesrvm.mm.mmtk, in the
>> MMTk/ext/vm/jikesrvm directory)
>>
>> but I think it would generally be a bad idea for you to allocate memory
>> for JikesRVM using sysMalloc.
>>
>> Regards,
>> Robin
>>
>>
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables unlimited
>> royalty-free distribution of the report engine for externally facing
>> server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> Jikesrvm-researchers mailing list
>> Jikesrvm-researchers@...
>> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>>
>>  
>>    
>
>
>  


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

 « Return to Thread: [rvm-research] to utilize methods in syscall