ytljit 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/ytljit.h +2 -2
- data/lib/ytljit/asmext.rb +20 -0
- data/lib/ytljit/asmext_x64.rb +10 -2
- data/lib/ytljit/asmext_x86.rb +1 -1
- data/lib/ytljit/asmutil.rb +7 -1
- data/lib/ytljit/instruction_ia.rb +47 -5
- data/lib/ytljit/util.rb +1 -0
- data/lib/ytljit/vm.rb +405 -82
- data/lib/ytljit/vm_codegen.rb +12 -13
- data/lib/ytljit/vm_inline_method.rb +24 -21
- data/lib/ytljit/vm_sendnode.rb +361 -187
- data/lib/ytljit/vm_trans.rb +57 -10
- data/lib/ytljit/vm_type.rb +27 -18
- data/lib/ytljit/vm_type_gen.rb +0 -2
- data/test/vmtest.rb +5 -1
- metadata +3 -3
data/lib/ytljit/vm_codegen.rb
CHANGED
@@ -82,7 +82,7 @@ LO | | | |
|
|
82
82
|
end
|
83
83
|
|
84
84
|
attr :top_node
|
85
|
-
|
85
|
+
attr_accessor :modified_local_var
|
86
86
|
attr_accessor :modified_instance_var
|
87
87
|
attr_accessor :yield_node
|
88
88
|
|
@@ -101,7 +101,7 @@ LO | | | |
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
-
@modified_local_var = res
|
104
|
+
@modified_local_var[-1] = res
|
105
105
|
end
|
106
106
|
|
107
107
|
def merge_instance_var(lvlist)
|
@@ -128,11 +128,11 @@ LO | | | |
|
|
128
128
|
@visited_top_node = {}
|
129
129
|
end
|
130
130
|
|
131
|
-
def
|
131
|
+
def to_signature(offset = -1)
|
132
132
|
cursig = @current_method_signature_node[offset]
|
133
133
|
res = cursig.map { |enode|
|
134
134
|
if enode.is_a?(Node::BaseNode) then
|
135
|
-
enode.decide_type_once(
|
135
|
+
enode.decide_type_once(to_signature(offset - 1))
|
136
136
|
enode.type
|
137
137
|
else
|
138
138
|
enode
|
@@ -186,7 +186,7 @@ LO | | | |
|
|
186
186
|
|
187
187
|
attr_accessor :slf
|
188
188
|
|
189
|
-
|
189
|
+
attr_accessor :options
|
190
190
|
|
191
191
|
def set_reg_content(dst, val)
|
192
192
|
if dst.is_a?(FunctionArgument) then
|
@@ -299,7 +299,7 @@ LO | | | |
|
|
299
299
|
else
|
300
300
|
raise "Not saved reg #{reg}"
|
301
301
|
end
|
302
|
-
if @depth_reg[reg] !=
|
302
|
+
if @depth_reg[reg] != -1 then
|
303
303
|
assembler.with_retry do
|
304
304
|
assembler.pop(reg)
|
305
305
|
cpustack_pop(reg)
|
@@ -313,7 +313,7 @@ LO | | | |
|
|
313
313
|
def end_using_reg(reg)
|
314
314
|
case reg
|
315
315
|
when OpRegistor
|
316
|
-
if reg != TMPR then
|
316
|
+
if reg != TMPR and reg != XMM0 then
|
317
317
|
end_using_reg_aux(reg)
|
318
318
|
end
|
319
319
|
|
@@ -333,7 +333,7 @@ LO | | | |
|
|
333
333
|
end
|
334
334
|
end
|
335
335
|
|
336
|
-
def
|
336
|
+
def to_signature(offset = -1)
|
337
337
|
@current_method_signature[offset]
|
338
338
|
end
|
339
339
|
end
|
@@ -416,7 +416,7 @@ LO | | | |
|
|
416
416
|
print "---- Stack map ----\n"
|
417
417
|
@frame_info.frame_layout.each_with_index do |vinf, i|
|
418
418
|
ro = @frame_info.real_offset(i)
|
419
|
-
if mlv = @modified_local_var[0][ro] then
|
419
|
+
if mlv = @modified_local_var.last[0][ro] then
|
420
420
|
print " #{mlv.class} \n"
|
421
421
|
else
|
422
422
|
print " #{vinf.class} \n"
|
@@ -441,15 +441,14 @@ LO | | | |
|
|
441
441
|
|
442
442
|
rarg.each_with_index do |arg, i|
|
443
443
|
context = arg.compile(context)
|
444
|
-
context.ret_node.decide_type_once(context.
|
444
|
+
context.ret_node.decide_type_once(context.to_signature)
|
445
445
|
rtype = context.ret_node.type
|
446
446
|
context = rtype.gen_boxing(context)
|
447
447
|
casm = context.assembler
|
448
448
|
dst = OpIndirect.new(SPR, i * AsmType::MACHINE_WORD.size)
|
449
|
-
if
|
449
|
+
if context.ret_reg.is_a?(OpRegistor) or
|
450
450
|
context.ret_reg.is_a?(OpImmidiate32) or
|
451
451
|
context.ret_reg.is_a?(OpImmidiate8) then
|
452
|
-
|
453
452
|
casm.with_retry do
|
454
453
|
casm.mov(dst, context.ret_reg)
|
455
454
|
end
|
@@ -460,7 +459,7 @@ LO | | | |
|
|
460
459
|
casm.mov(dst, TMPR)
|
461
460
|
end
|
462
461
|
end
|
463
|
-
context.cpustack_setn(i
|
462
|
+
context.cpustack_setn(i, context.ret_node)
|
464
463
|
end
|
465
464
|
|
466
465
|
# Copy Stack Pointer
|
@@ -18,17 +18,21 @@ module YTLJit
|
|
18
18
|
end
|
19
19
|
context.set_reg_content(tempreg, context.ret_node)
|
20
20
|
|
21
|
-
# @
|
22
|
-
# @
|
23
|
-
#
|
24
|
-
@arguments[3
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
# @argunents[1] is block
|
22
|
+
# @argunents[2] is self
|
23
|
+
# @arguments[3] is other
|
24
|
+
aele = @arguments[3]
|
25
|
+
context = aele.compile(context)
|
26
|
+
context.ret_node.decide_type_once(context.to_signature)
|
27
|
+
rtype = context.ret_node.type
|
28
|
+
context = rtype.gen_unboxing(context)
|
29
29
|
|
30
|
-
|
30
|
+
asm = context.assembler
|
31
|
+
if block_given? then
|
32
|
+
yield(context)
|
33
|
+
else
|
31
34
|
asm.with_retry do
|
35
|
+
# default code
|
32
36
|
if context.ret_reg.using(tempreg) then
|
33
37
|
asm.mov(TMPR, context.ret_reg)
|
34
38
|
context.end_using_reg(context.ret_reg)
|
@@ -37,20 +41,19 @@ module YTLJit
|
|
37
41
|
asm.send(inst, tempreg, context.ret_reg)
|
38
42
|
context.end_using_reg(context.ret_reg)
|
39
43
|
end
|
44
|
+
asm.mov(resreg, tempreg)
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
43
|
-
asm.with_retry do
|
44
|
-
asm.mov(resreg, tempreg)
|
45
|
-
end
|
46
48
|
context.end_using_reg(tempreg)
|
47
|
-
|
49
|
+
|
48
50
|
context.ret_node = self
|
49
51
|
context.ret_reg = resreg
|
50
52
|
|
51
|
-
decide_type_once(context.
|
52
|
-
|
53
|
-
|
53
|
+
decide_type_once(context.to_signature)
|
54
|
+
|
55
|
+
if @type.boxed then
|
56
|
+
context = @type.gen_boxing(context)
|
54
57
|
end
|
55
58
|
|
56
59
|
context
|
@@ -66,12 +69,12 @@ module YTLJit
|
|
66
69
|
end
|
67
70
|
context.set_reg_content(tempreg, context.ret_node)
|
68
71
|
|
69
|
-
# @
|
70
|
-
# @
|
71
|
-
#
|
72
|
+
# @arguments[1] is block
|
73
|
+
# @arguments[2] is self
|
74
|
+
# @arguments[3] is other arg
|
72
75
|
aele = @arguments[3]
|
73
76
|
context = aele.compile(context)
|
74
|
-
context.ret_node.decide_type_once(context.
|
77
|
+
context.ret_node.decide_type_once(context.to_signature)
|
75
78
|
rtype = context.ret_node.type
|
76
79
|
context = rtype.gen_unboxing(context)
|
77
80
|
|
@@ -89,7 +92,7 @@ module YTLJit
|
|
89
92
|
context.ret_node = self
|
90
93
|
context.ret_reg = resreg
|
91
94
|
|
92
|
-
decide_type_once(context.
|
95
|
+
decide_type_once(context.to_signature)
|
93
96
|
if type.boxed then
|
94
97
|
context = type.gen_boxing(context)
|
95
98
|
end
|