Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wa-lang
wa
提交
3a9f054a
wa
项目概览
wa-lang
/
wa
大约 1 年 前同步成功
通知
68
Star
655
Fork
45
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
wa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3a9f054a
编写于
5月 25, 2023
作者:
3
3dgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
统一运行时内部标识符到 wa.runtime.
上级
b7fb5ff5
变更
14
显示空白变更内容
内联
并排
Showing
14 changed file
with
50 addition
and
86 deletion
+50
-86
_examples/interface_named.wa
_examples/interface_named.wa
+1
-0
internal/backends/compiler_wat/compile.go
internal/backends/compiler_wat/compile.go
+1
-1
internal/backends/compiler_wat/compile_func.go
internal/backends/compiler_wat/compile_func.go
+2
-2
internal/backends/compiler_wat/wir/module.go
internal/backends/compiler_wat/wir/module.go
+3
-3
internal/backends/compiler_wat/wir/value_basic.go
internal/backends/compiler_wat/wir/value_basic.go
+1
-1
internal/backends/compiler_wat/wir/value_block.go
internal/backends/compiler_wat/wir/value_block.go
+16
-16
internal/backends/compiler_wat/wir/value_closure.go
internal/backends/compiler_wat/wir/value_closure.go
+1
-1
internal/backends/compiler_wat/wir/value_interface.go
internal/backends/compiler_wat/wir/value_interface.go
+4
-4
internal/backends/compiler_wat/wir/value_slice.go
internal/backends/compiler_wat/wir/value_slice.go
+4
-4
internal/backends/compiler_wat/wir/value_sptr.go
internal/backends/compiler_wat/wir/value_sptr.go
+1
-1
internal/backends/compiler_wat/wir/value_string.go
internal/backends/compiler_wat/wir/value_string.go
+2
-2
internal/waroot/_waroot/src/runtime/heap.wat.ws
internal/waroot/_waroot/src/runtime/heap.wat.ws
+7
-44
internal/waroot/_waroot/src/runtime/runtime.wa
internal/waroot/_waroot/src/runtime/runtime.wa
+2
-2
internal/waroot/_waroot/src/runtime/runtime_type.wa
internal/waroot/_waroot/src/runtime/runtime_type.wa
+5
-5
未找到文件。
_examples/interface_named.wa
浏览文件 @
3a9f054a
...
...
@@ -28,6 +28,7 @@ func main() {
v1 := S1{a: 13}
var i1: I1 = &v1 //具体类型到具名接口
v1.f() //直接调用
i1.f() //接口调用
doConcreteType(i1)
i1.f()
...
...
internal/backends/compiler_wat/compile.go
浏览文件 @
3a9f054a
...
...
@@ -25,7 +25,7 @@ type Compiler struct {
func
New
()
*
Compiler
{
p
:=
new
(
Compiler
)
p
.
module
=
wir
.
NewModule
()
p
.
module
.
AddGlobal
(
"$wa.
RT
.closure_data"
,
p
.
module
.
GenValueType_SPtr
(
p
.
module
.
VOID
),
false
,
nil
)
p
.
module
.
AddGlobal
(
"$wa.
runtime
.closure_data"
,
p
.
module
.
GenValueType_SPtr
(
p
.
module
.
VOID
),
false
,
nil
)
wir
.
SetCurrentModule
(
p
.
module
)
return
p
}
...
...
internal/backends/compiler_wat/compile_func.go
浏览文件 @
3a9f054a
...
...
@@ -912,7 +912,7 @@ func (g *functionGenerator) genMakeClosre_Anonymous(inst *ssa.MakeClosure) (inst
}
warp_fn
.
Results
=
g
.
tLib
.
GenFnSig
(
f
.
Signature
)
.
Results
dx
:=
g
.
module
.
FindGlobalByName
(
"$wa.
RT
.closure_data"
)
dx
:=
g
.
module
.
FindGlobalByName
(
"$wa.
runtime
.closure_data"
)
data_ptr
:=
wir
.
ExtractField
(
dx
,
"data"
)
warp_fn
.
Insts
=
append
(
warp_fn
.
Insts
,
st_free_data
.
EmitLoadFromAddr
(
data_ptr
,
0
)
...
)
...
...
@@ -976,7 +976,7 @@ func (g *functionGenerator) genMakeClosre_Bound(inst *ssa.MakeClosure) (insts []
}
warp_fn
.
Results
=
g
.
tLib
.
GenFnSig
(
f
.
Signature
)
.
Results
dx
:=
g
.
module
.
FindGlobalByName
(
"$wa.
RT
.closure_data"
)
dx
:=
g
.
module
.
FindGlobalByName
(
"$wa.
runtime
.closure_data"
)
data_ptr
:=
wir
.
ExtractField
(
dx
,
"data"
)
warp_fn
.
Insts
=
append
(
warp_fn
.
Insts
,
recv_type
.
EmitLoadFromAddr
(
data_ptr
,
0
)
...
)
...
...
internal/backends/compiler_wat/wir/module.go
浏览文件 @
3a9f054a
...
...
@@ -363,9 +363,9 @@ func (m *Module) buildItab() {
}
itabs_ptr
:=
m
.
DataSeg
.
Append
(
itabs
,
8
)
m
.
SetGlobalInitValue
(
"$wa.
RT
._itabsPtr"
,
strconv
.
Itoa
(
itabs_ptr
))
m
.
SetGlobalInitValue
(
"$wa.
RT
._interfaceCount"
,
strconv
.
Itoa
(
len
(
m
.
usedInterfaces
)))
m
.
SetGlobalInitValue
(
"$wa.
RT
._concretTypeCount"
,
strconv
.
Itoa
(
len
(
m
.
usedConcreteTypes
)))
m
.
SetGlobalInitValue
(
"$wa.
runtime
._itabsPtr"
,
strconv
.
Itoa
(
itabs_ptr
))
m
.
SetGlobalInitValue
(
"$wa.
runtime
._interfaceCount"
,
strconv
.
Itoa
(
len
(
m
.
usedInterfaces
)))
m
.
SetGlobalInitValue
(
"$wa.
runtime
._concretTypeCount"
,
strconv
.
Itoa
(
len
(
m
.
usedConcreteTypes
)))
}
func
(
m
*
Module
)
buildTypesInfo
()
{
...
...
internal/backends/compiler_wat/wir/value_basic.go
浏览文件 @
3a9f054a
...
...
@@ -159,7 +159,7 @@ func (v *aBasic) emitStoreToAddr(addr Value, offset int) []wat.Inst {
}
func
(
v
*
aBasic
)
emitStore
(
offset
int
)
(
insts
[]
wat
.
Inst
)
{
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
insts
=
append
(
insts
,
v
.
EmitPush
()
...
)
switch
v
.
Type
()
.
(
type
)
{
case
*
tU8
,
*
tI8
:
...
...
internal/backends/compiler_wat/wir/value_block.go
浏览文件 @
3a9f054a
...
...
@@ -62,7 +62,7 @@ func (t *Block) onFree() int {
f
.
Insts
=
append
(
f
.
Insts
,
ptr
.
EmitPush
()
...
)
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstLoad
(
wat
.
U32
{},
0
,
1
))
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstCall
(
"$wa.
RT
.Block.Release"
))
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.Block.Release"
))
f
.
Insts
=
append
(
f
.
Insts
,
ptr
.
EmitPush
()
...
)
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstConst
(
wat
.
U32
{},
"0"
))
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstStore
(
wat
.
U32
{},
0
,
1
))
...
...
@@ -74,7 +74,7 @@ func (t *Block) onFree() int {
func
(
t
*
Block
)
EmitLoadFromAddr
(
addr
Value
,
offset
int
)
(
insts
[]
wat
.
Inst
)
{
insts
=
append
(
insts
,
addr
.
EmitPush
()
...
)
insts
=
append
(
insts
,
wat
.
NewInstLoad
(
wat
.
U32
{},
offset
,
1
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.Block.Retain"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.Block.Retain"
))
return
}
...
...
@@ -107,7 +107,7 @@ func (t *Block) emitHeapAlloc(item_count Value) (insts []wat.Inst) {
insts
=
append
(
insts
,
item_count
.
EmitPush
()
...
)
//item_count
insts
=
append
(
insts
,
NewConst
(
strconv
.
Itoa
(
t
.
Base
.
onFree
()),
t
.
_u32
)
.
EmitPush
()
...
)
//free_method
insts
=
append
(
insts
,
NewConst
(
strconv
.
Itoa
(
t
.
Base
.
Size
()),
t
.
_u32
)
.
EmitPush
()
...
)
//item_size
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.Block.Init"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.Block.Init"
))
return
}
...
...
@@ -135,7 +135,7 @@ func (v *aBlock) EmitInit() (insts []wat.Inst) {
func
(
v
*
aBlock
)
EmitPush
()
(
insts
[]
wat
.
Inst
)
{
insts
=
append
(
insts
,
v
.
push
(
v
.
name
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.Block.Retain"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.Block.Retain"
))
return
}
...
...
@@ -147,7 +147,7 @@ func (v *aBlock) EmitPop() (insts []wat.Inst) {
func
(
v
*
aBlock
)
EmitRelease
()
(
insts
[]
wat
.
Inst
)
{
insts
=
append
(
insts
,
v
.
push
(
v
.
name
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.Block.Release"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.Block.Release"
))
return
}
...
...
@@ -156,19 +156,19 @@ func (v *aBlock) emitStoreToAddr(addr Value, offset int) (insts []wat.Inst) {
insts
=
append
(
insts
,
v
.
EmitPush
()
...
)
// a v
insts
=
append
(
insts
,
addr
.
EmitPush
()
...
)
// a v a
insts
=
append
(
insts
,
wat
.
NewInstLoad
(
wat
.
U32
{},
offset
,
1
))
// a v o
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.Block.Release"
))
// a v
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.Block.Release"
))
// a v
insts
=
append
(
insts
,
wat
.
NewInstStore
(
toWatType
(
v
.
Type
()),
offset
,
1
))
return
}
func
(
v
*
aBlock
)
emitStore
(
offset
int
)
(
insts
[]
wat
.
Inst
)
{
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
// a
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
// a a
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
// a
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
// a a
insts
=
append
(
insts
,
v
.
EmitPush
()
...
)
// a a v
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.SwapI32"
))
// a v a
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.SwapI32"
))
// a v a
insts
=
append
(
insts
,
wat
.
NewInstLoad
(
wat
.
U32
{},
offset
,
1
))
// a v o
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.Block.Release"
))
// a v
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.Block.Release"
))
// a v
insts
=
append
(
insts
,
wat
.
NewInstStore
(
toWatType
(
v
.
Type
()),
offset
,
1
))
return
...
...
internal/backends/compiler_wat/wir/value_closure.go
浏览文件 @
3a9f054a
...
...
@@ -141,7 +141,7 @@ func EmitCallClosure(c Value, params []Value) (insts []wat.Inst) {
insts
=
append
(
insts
,
closure
.
Extract
(
"fn_index"
)
.
EmitPush
()
...
)
insts
=
append
(
insts
,
closure
.
Extract
(
"data"
)
.
EmitPush
()
...
)
insts
=
append
(
insts
,
currentModule
.
FindGlobalByName
(
"$wa.
RT
.closure_data"
)
.
EmitPop
()
...
)
insts
=
append
(
insts
,
currentModule
.
FindGlobalByName
(
"$wa.
runtime
.closure_data"
)
.
EmitPop
()
...
)
insts
=
append
(
insts
,
wat
.
NewInstCallIndirect
(
closure
.
typ
.
_fnTypeName
))
return
...
...
internal/backends/compiler_wat/wir/value_interface.go
浏览文件 @
3a9f054a
...
...
@@ -58,7 +58,7 @@ func (t *Interface) emitGenFromSPtr(x *aSPtr) (insts []wat.Inst) {
insts
=
append
(
insts
,
wat
.
NewInstConst
(
wat
.
I32
{},
strconv
.
Itoa
(
x
.
Type
()
.
Hash
())))
insts
=
append
(
insts
,
wat
.
NewInstConst
(
wat
.
I32
{},
strconv
.
Itoa
(
t
.
Hash
())))
insts
=
append
(
insts
,
wat
.
NewInstConst
(
wat
.
I32
{},
"0"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.getItab"
))
//itab
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.getItab"
))
//itab
return
}
...
...
@@ -70,7 +70,7 @@ func (t *Interface) emitGenFromInterface(x *aInterface) (insts []wat.Inst) {
insts
=
append
(
insts
,
wat
.
NewInstLoad
(
wat
.
I32
{},
0
,
4
))
insts
=
append
(
insts
,
wat
.
NewInstConst
(
wat
.
I32
{},
strconv
.
Itoa
(
t
.
Hash
())))
insts
=
append
(
insts
,
wat
.
NewInstConst
(
wat
.
I32
{},
"0"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.getItab"
))
//itab
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.getItab"
))
//itab
return
}
...
...
@@ -144,9 +144,9 @@ func (v *aInterface) emitQueryInterface(destType ValueType, commaOk bool) (insts
}
else
{
insts
=
append
(
insts
,
wat
.
NewInstConst
(
wat
.
I32
{},
"0"
))
}
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.getItab"
))
//itab
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.getItab"
))
//itab
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
ifBlock
:=
wat
.
NewInstIf
(
nil
,
nil
,
nil
)
if
commaOk
{
ifBlock
.
Ret
=
append
(
ifBlock
.
Ret
,
wat
.
I32
{})
...
...
internal/backends/compiler_wat/wir/value_slice.go
浏览文件 @
3a9f054a
...
...
@@ -67,7 +67,7 @@ func (t *Slice) emitGenFromRefOfSlice(x *aSPtr, low, high Value) (insts []wat.In
//block
insts
=
append
(
insts
,
x
.
Extract
(
"data"
)
.
EmitPush
()
...
)
insts
=
append
(
insts
,
wat
.
NewInstLoad
(
wat
.
U32
{},
0
,
1
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.Block.Retain"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.Block.Retain"
))
//data
if
low
==
nil
{
...
...
@@ -139,7 +139,7 @@ func (t *Slice) emitGenMake(Len, Cap Value) (insts []wat.Inst) {
insts
=
append
(
insts
,
t
.
_base_block
.
emitHeapAlloc
(
Cap
)
...
)
//data
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
insts
=
append
(
insts
,
NewConst
(
"16"
,
t
.
_u32
)
.
EmitPush
()
...
)
insts
=
append
(
insts
,
wat
.
NewInstAdd
(
wat
.
U32
{}))
...
...
@@ -269,10 +269,10 @@ func (t *Slice) genAppendFunc() string {
if_false
=
append
(
if_false
,
new_cap
.
EmitPop
()
...
)
if_false
=
append
(
if_false
,
t
.
_base_block
.
emitHeapAlloc
(
new_cap
)
...
)
//block
if_false
=
append
(
if_false
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
if_false
=
append
(
if_false
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
if_false
=
append
(
if_false
,
NewConst
(
"16"
,
t
.
_u32
)
.
EmitPush
()
...
)
if_false
=
append
(
if_false
,
wat
.
NewInstAdd
(
wat
.
U32
{}))
//data
if_false
=
append
(
if_false
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
if_false
=
append
(
if_false
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
if_false
=
append
(
if_false
,
dest
.
EmitPop
()
...
)
//dest
if_false
=
append
(
if_false
,
new_len
.
EmitPush
()
...
)
//len
if_false
=
append
(
if_false
,
new_cap
.
EmitPush
()
...
)
//cap
...
...
internal/backends/compiler_wat/wir/value_sptr.go
浏览文件 @
3a9f054a
...
...
@@ -58,7 +58,7 @@ func (t *SPtr) emitHeapAlloc() (insts []wat.Inst) {
//insts = append(insts, wat.NewComment("Ref.emitHeapAlloc start"))
insts
=
append
(
insts
,
t
.
_base_block
.
emitHeapAlloc
(
NewConst
(
"1"
,
t
.
underlying
.
_u32
))
...
)
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
insts
=
append
(
insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
insts
=
append
(
insts
,
NewConst
(
"16"
,
t
.
underlying
.
_u32
)
.
EmitPush
()
...
)
insts
=
append
(
insts
,
wat
.
NewInstAdd
(
wat
.
U32
{}))
...
...
internal/backends/compiler_wat/wir/value_string.go
浏览文件 @
3a9f054a
...
...
@@ -101,10 +101,10 @@ func (t *String) genFunc_Append() string {
//gen new slice
f
.
Insts
=
append
(
f
.
Insts
,
t
.
_u8_block
.
emitHeapAlloc
(
new_len
)
...
)
//block
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
f
.
Insts
=
append
(
f
.
Insts
,
NewConst
(
"16"
,
t
.
_u32
)
.
EmitPush
()
...
)
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstAdd
(
wat
.
U32
{}))
//data
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstCall
(
"$wa.
RT
.DupI32"
))
f
.
Insts
=
append
(
f
.
Insts
,
wat
.
NewInstCall
(
"$wa.
runtime
.DupI32"
))
f
.
Insts
=
append
(
f
.
Insts
,
dest
.
EmitPop
()
...
)
//dest
f
.
Insts
=
append
(
f
.
Insts
,
new_len
.
EmitPush
()
...
)
//len
...
...
internal/waroot/_waroot/src/runtime/heap.wat.ws
浏览文件 @
3a9f054a
...
...
@@ -70,50 +70,14 @@
end ;;loop $zero
local.get $ptr
;;Todo
;; global.get $__heap_base
;; global.get $__heap_base
;; call $$runtime.waPrintI32
;; i32.const 32
;; call $$runtime.waPrintRune
;; local.get $size
;; call $$runtime.waPrintI32
;; i32.const 10
;; call $$runtime.waPrintRune
;; global.get $__heap_base
;; global.get $__heap_base
;; local.get $nbytes
;; i32.const 7
;; i32.add
;; i32.const 8
;; i32.div_u
;; i32.const 8
;; i32.mul
;; i32.add
;; global.set $__heap_base
;; call $$wa.RT.DupWatStack
;; call $$runtime.waPrintI32
;; i32.const 10
;; call $$runtime.waPrintRune
)
(func $$waHeapFree (param $ptr i32)
local.get $ptr
call $runtime.free
;;Todo
;; i32.const 126
;; call $$runtime.waPrintRune
;; local.get $ptr
;; call $$runtime.waPrintI32
;; i32.const 10
;; call $$runtime.waPrintRune
)
(func $$wa.
RT
.Block.Init (param $ptr i32) (param $item_count i32) (param $release_func i32) (param $item_size i32) (result i32) ;;result = ptr
(func $$wa.
runtime
.Block.Init (param $ptr i32) (param $item_count i32) (param $release_func i32) (param $item_size i32) (result i32) ;;result = ptr
local.get $ptr
local.get $ptr
...
...
@@ -136,17 +100,17 @@
end
)
(func $$wa.
RT
.DupI32 (param i32) (result i32 i32) ;;r0 = r1 = p0
(func $$wa.
runtime
.DupI32 (param i32) (result i32 i32) ;;r0 = r1 = p0
local.get 0
local.get 0
)
(func $$wa.
RT
.SwapI32 (param i32 i32) (result i32 i32) ;;r0 = p1, r1 = p0
(func $$wa.
runtime
.SwapI32 (param i32 i32) (result i32 i32) ;;r0 = p1, r1 = p0
local.get 1
local.get 0
)
(func $$wa.
RT
.Block.Retain (param $ptr i32) (result i32) ;;result = ptr
(func $$wa.
runtime
.Block.Retain (param $ptr i32) (result i32) ;;result = ptr
local.get $ptr
local.get $ptr
...
...
@@ -160,8 +124,7 @@
end
)
(func $$wa.RT.Block.Release (param $ptr i32)
;;Todo
(func $$wa.runtime.Block.Release (param $ptr i32)
(local $ref_count i32)
(local $item_count i32)
(local $free_func i32)
...
...
@@ -240,10 +203,10 @@
end ;;ref_count == 0
)
(func $$wa.
RT
.i32_ref_to_ptr (param $b i32) (param $d i32) (result i32) ;;result = ptr
(func $$wa.
runtime
.i32_ref_to_ptr (param $b i32) (param $d i32) (result i32) ;;result = ptr
local.get $d
)
(func $$wa.
RT
.slice_to_ptr (param $b i32) (param $d i32) (param $l i32) (param $c i32) (result i32) ;;result = ptr
(func $$wa.
runtime
.slice_to_ptr (param $b i32) (param $d i32) (param $l i32) (param $c i32) (result i32) ;;result = ptr
local.get $d
)
internal/waroot/_waroot/src/runtime/runtime.wa
浏览文件 @
3a9f054a
...
...
@@ -143,10 +143,10 @@ func free(ap: u32) {
knr_freep = p_addr
}
#wa:linkname $wa.
RT
.i32_ref_to_ptr
#wa:linkname $wa.
runtime
.i32_ref_to_ptr
func I32_ref_to_ptr(t: *i32) => i32
#wa:linkname $wa.
RT
.slice_to_ptr
#wa:linkname $wa.
runtime
.slice_to_ptr
func U8_slice_to_ptr(t: []byte) => i32
func refToPtr_i32(p: *i32) => i32 {
...
...
internal/waroot/_waroot/src/runtime/runtime_type.wa
浏览文件 @
3a9f054a
...
...
@@ -71,12 +71,12 @@ type _itab struct {
ihash: i32 //hash of interface
} //followed by [itype.methodCound]fnID, fnID=>id for call_indirect
#wa:linkname $wa.
RT
.getTypePtr
#wa:linkname $wa.
runtime
.getTypePtr
func getTypePtr(hash i32) uintptr {
return 0
}
#wa:linkname $wa.
RT
.getItab
#wa:linkname $wa.
runtime
.getItab
func getItab(dhash i32, ihash i32, commanok i32) u32 {
itab := _itabsPtr + ((dhash - 1) * _interfaceCount - ihash - 1) * 4
return getU32(u32(itab))
...
...
@@ -85,11 +85,11 @@ func getItab(dhash i32, ihash i32, commanok i32) u32 {
#wa:runtime_getter
func getU32(p: u32) => u32
#wa:linkname $wa.
RT
._itabsPtr
#wa:linkname $wa.
runtime
._itabsPtr
var _itabsPtr i32
#wa:linkname $wa.
RT
._interfaceCount
#wa:linkname $wa.
runtime
._interfaceCount
var _interfaceCount i32
#wa:linkname $wa.
RT
._concretTypeCount
#wa:linkname $wa.
runtime
._concretTypeCount
var _concretTypeCount i32
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录