want to port JIT to MIPS

71 篇文章 0 订阅
42 篇文章 0 订阅

want to port JIT to MIPS

> I'd appreaciate your help to clarify the problem I faced:
>
> 1.In JIT.cpp I roughly understand ctiTrampoline() except for  
> sp-0x1C, I guess the 1C includes 6 argument yet the 7th or 1st may  
> be the hidden C++ pointer? And the reserved 1C stack space seems not  
> used? why esi is forced to be 512 rather than use input argument?

The JIT allocates a fixed frame on the stack which is used to pass  
arguments into stub functions.  The 0x1C contains a spare word or two  
to maintain stack alignment.  %esi is used in the timeout check  
mechanism.

> 2.How to understand the stack balance in ctiVMThrowTrampoline()? why  
> after calling we still add 1C w/o sub 1C before calling? where comes  
> _ZN3JSC11Interpreter12cti_vm_throwEPPv and how do I know which name  
> for Mips? does this one relates to variable argument function call?

ctiVMThrowTrampoline is never called as a function (it is declared as  
a function only to provide a symbol that can be manipulated from C  
code).  ctiVMThrowTrampoline is used in returning back from JIT  
generated code, in the case of an exception.

> 3.I know how to handle jump in Mips, but not sure how/when to handle  
> patchAddress/patchImm/patchPointer because I'm not sure the  
> instructions related. I guess all patches are for last 32bit IMM  
> field of instructions.
> Mips can't load 32bit in one instruction, thus I need to know the  
> instruction before I can patch/add in the 32bit data.
>
> 4.I'm kind of want no asm code outside <assembler> folder, any plan  
> for that?

No.  The assembler is intended to be independent of JavaScript types -  
it's just an assembler.  The asm trampolines are specific to the JIT.   
It is currently the intention that architecture specific parts of the  
JIT implementation will remain in the jit folder.

I'd suggest that in attempting to port the jit, WREC would be a good  
place to start.



Thanks a lot otherwise I have misunderstanding. Yes I'll do wrec first. I just want to clean up possible blocking issues.

I see wrec uses regparm(3) and jit always use fastcall for X86?
In JIT.cpp ctiTrampoline put CallFrame in edi, but how about other arguments - where are they be fetched/poped from stack? 

when deal with caller/callee saved regs, gcc MIPS just preserves them when necesasary. The problem is after JIT used gcc may not have enough knowledge on "necessary", do we have a way to force gcc always preserve 
them? 

how to identify a patch (patchimm/patchptr/patchaddr) relates to a data field in an instruction or relates to an element in a data array? In Mips the former means the 32bit needs to be separated into two 16bits and patched into two instructions. But if a 32bit is a pointer in a pointer array, we can save it directly.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值