fix self issue (#808)

This commit is contained in:
water111
2021-09-01 16:42:24 -04:00
committed by GitHub
parent 3cda946372
commit 6d120c1ac8
7 changed files with 54 additions and 220 deletions
+2 -30
View File
@@ -2146,13 +2146,6 @@ void SetVarElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
return;
}
// bool skip = false;
// auto dst_type = env.get_variable_type(m_dst, false);
// auto as_bitfield = dynamic_cast<BitFieldType*>(env.dts->ts.lookup_type(dst_type));
// if (as_bitfield && as_bitfield->get_load_size() == 16) {
// skip = true;
// }
// if we are a reg-reg move that consumes the original, push it without popping from stack.
// it is the Stack's responsibility to untangle these later on.
if (m_src->is_single_element()) {
@@ -2168,7 +2161,8 @@ void SetVarElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
auto var = src_as_se->expr().get_arg(0).var();
auto& info = env.reg_use().op.at(var.idx());
if (info.consumes.find(var.reg()) != info.consumes.end()) {
if (var.reg() == Register(Reg::GPR, Reg::S6) ||
info.consumes.find(var.reg()) != info.consumes.end()) {
stack.push_non_seq_reg_to_reg(m_dst, src_as_se->expr().get_arg(0).var(), m_src,
m_src_type, m_var_info);
return;
@@ -2180,28 +2174,6 @@ void SetVarElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
// we aren't a reg-reg move, so update our source
m_src->update_children_from_stack(env, pool, stack, true);
/*
auto src_as_bf_set = dynamic_cast<ModifiedCopyBitfieldElement*>(m_src->try_as_single_element());
if (src_as_bf_set && !src_as_bf_set->from_pcpyud() && src_as_bf_set->mods().size() == 1) {
auto dst_form = m_dst.to_form(env, RegisterAccess::Print::AS_VARIABLE_NO_CAST);
auto src_form = src_as_bf_set->base()->to_form(env);
if (dst_form == src_form) {
// success!
auto value = src_as_bf_set->mods().at(0).value;
value->parent_element = this;
// make the (-> thing bitfield)
auto field_token = DerefToken::make_field_name(src_as_bf_set->mods().at(0).field_name);
auto dst_dform = pool.alloc_single_element_form<SimpleAtomElement>(nullptr,
SimpleAtom::make_var(m_dst)); auto loc_elt = pool.alloc_element<DerefElement>(dst_dform, false,
field_token); loc_elt->inline_nested(); auto loc = pool.alloc_single_form(nullptr, loc_elt); auto
new_form_el = pool.alloc_element<SetFormFormElement>(loc, value);
stack.push_form_element(new_form_el, true);
return;
}
}
*/
for (auto x : m_src->elts()) {
assert(x->parent_form == m_src);
}
+3 -3
View File
@@ -330,7 +330,7 @@ goos::Object decomp_ref_to_inline_array_guess_size(
const LinkedObjectFile* file,
const TypeSpec& array_elt_type,
int stride) {
fmt::print("Decomp decomp_ref_to_inline_array_guess_size {}\n", array_elt_type.print());
// fmt::print("Decomp decomp_ref_to_inline_array_guess_size {}\n", array_elt_type.print());
// verify that the field is the right type.
assert(data_field.type() == TypeSpec("inline-array", {array_elt_type}));
@@ -353,13 +353,13 @@ goos::Object decomp_ref_to_inline_array_guess_size(
index_of_closest_following_label_in_segment(start_label.offset, my_seg, labels);
assert(end_label_idx >= 0);
const auto& end_label = labels.at(end_label_idx);
fmt::print("Data is from {} to {}\n", start_label.name, end_label.name);
// fmt::print("Data is from {} to {}\n", start_label.name, end_label.name);
// now we can figure out the size
int size_bytes = end_label.offset - start_label.offset;
int size_elts = size_bytes / stride; // 32 bytes per ocean-near-index
int leftover_bytes = size_bytes % stride;
fmt::print("Size is {} bytes: {} elts, {} left over\n", size_bytes, size_elts, leftover_bytes);
// fmt::print("Size is {} bytes: {} elts, {} left over\n", size_bytes, size_elts, leftover_bytes);
// if we have leftover, should verify that its all zeros, or that it's the type pointer
// of the next basic in the data section.
+13 -51
View File
@@ -1241,14 +1241,7 @@
:code
(behavior ()
(while #t
(let* ((a0-0 *art-control*)
(t9-0 (method-of-object a0-0 spool-push))
(a1-0 "lrocklrg-falling")
(a2-0 0)
(t0-0 -1.0)
)
(t9-0 a0-0 a1-0 a2-0 self t0-0)
)
(spool-push *art-control* "lrocklrg-falling" 0 self -1.0)
(suspend)
)
(none)
@@ -1309,14 +1302,7 @@
(behavior ()
(local-vars (v1-3 symbol) (v1-49 symbol))
(until v1-3
(let* ((a0-0 *art-control*)
(t9-0 (method-of-object a0-0 spool-push))
(a1-0 "lrocklrg-falling")
(a2-0 0)
(t0-0 -1.0)
)
(t9-0 a0-0 a1-0 a2-0 self t0-0)
)
(spool-push *art-control* "lrocklrg-falling" 0 self -1.0)
(suspend)
(set! v1-3 (or (not *target*) (process-grab? *target*)))
)
@@ -1333,16 +1319,12 @@
(let* ((gp-1 (get-process *default-dead-pool* othercam #x4000))
(gp-2 (ppointer->handle (when gp-1
(let
((t9-5 (method-of-type othercam activate))
(a0-8 gp-1)
(a2-3 'othercam)
(a3-1 #x70004000)
)
((t9-5 (method-of-type othercam activate)))
(t9-5
(the-as othercam a0-8)
(the-as othercam gp-1)
self
a2-3
(the-as pointer a3-1)
'othercam
(the-as pointer #x70004000)
)
)
(let
@@ -1373,16 +1355,12 @@
(s5-0 (get-process *default-dead-pool* fuel-cell #x4000))
(s5-1 (ppointer->handle (when s5-0
(let
((t9-8 (method-of-type fuel-cell activate))
(a0-14 s5-0)
(a2-6 'fuel-cell)
(a3-3 #x70004000)
)
((t9-8 (method-of-type fuel-cell activate)))
(t9-8
(the-as fuel-cell a0-14)
(the-as fuel-cell s5-0)
self
a2-6
(the-as pointer a3-3)
'fuel-cell
(the-as pointer #x70004000)
)
)
((the-as
@@ -1404,14 +1382,7 @@
(task-status need-reminder)
)
(set! (-> self movie-start) (the-as uint (-> *display* base-frame-counter)))
(let* ((a0-20 *art-control*)
(t9-11 (method-of-object a0-20 spool-push))
(a1-9 "lrocklrg-falling")
(a2-11 0)
(t0-2 -1.0)
)
(t9-11 a0-20 a1-9 a2-11 self t0-2)
)
(spool-push *art-control* "lrocklrg-falling" 0 self -1.0)
(ja-play-spooled-anim
(new 'static 'spool-anim
:name "lrocklrg-falling"
@@ -1430,12 +1401,7 @@
(the-as art-joint-anim (-> self draw art-group data 3))
(the-as (function process-drawable symbol) false-func)
)
(let ((t9-13 process-entity-status!)
(a1-11 64)
(a2-13 #t)
)
(t9-13 self (the-as entity-perm-status a1-11) a2-13)
)
(process-entity-status! self (entity-perm-status complete) #t)
(cond
((handle->process gp-2)
(deactivate (-> gp-2 process 0))
@@ -1601,8 +1567,4 @@
(dummy-14 obj *lrocklrg-sg* '())
((method-of-type beach-rock copy-defaults!) obj arg0)
(none)
)
)
+7 -8
View File
@@ -2381,14 +2381,13 @@ nav-enemy-default-event-handler
(process-entity-status! self (entity-perm-status complete) #t)
(when (not (task-complete? *game-info* (-> self entity extra perm task)))
(label cfg-1)
(let ((t9-5 birth-pickup-at-point)
(a0-4 (-> self collide-info trans))
(a1-2 6)
(a2-1 (the float (the-as int (-> self entity extra perm task))))
(a3-0 #f)
(t1-0 #f)
)
(t9-5 a0-4 a1-2 a2-1 a3-0 self t1-0)
(birth-pickup-at-point
(-> self collide-info trans)
6
(the float (the-as int (-> self entity extra perm task)))
#f
self
#f
)
(when (not (-> self child))
(suspend)
+10 -70
View File
@@ -1124,14 +1124,7 @@
(if (arg3 self)
(goto cfg-88)
)
(let* ((a0-16 *art-control*)
(t9-11 (method-of-object a0-16 spool-push))
(a1-8 (-> arg0 name))
(a2-4 spool-part)
(t0-1 -9.0)
)
(t9-11 a0-16 a1-8 a2-4 self t0-1)
)
(spool-push *art-control* (-> arg0 name) spool-part self -9.0)
(suspend)
(when arg1
(let ((a0-17 (-> self skel root-channel 0)))
@@ -1156,23 +1149,9 @@
)
(set! sv-48 (-> *display* base-frame-counter))
(while (< spool-part (-> arg0 parts))
(let* ((a0-27 *art-control*)
(t9-13 (method-of-object a0-27 spool-push))
(a1-11 (-> arg0 name))
(a2-6 spool-part)
(t0-2 -20.0)
)
(t9-13 a0-27 a1-11 a2-6 self t0-2)
)
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(update *art-control* #f)
(let* ((a0-29 *art-control*)
(t9-15 (method-of-object a0-29 spool-push))
(a1-13 (-> arg0 name))
(a2-7 spool-part)
(t0-3 -20.0)
)
(t9-15 a0-29 a1-13 a2-7 self t0-3)
)
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active)
(cond
(arg1
@@ -1196,14 +1175,7 @@
(if (arg3 self)
(goto cfg-88)
)
(let* ((a0-35 *art-control*)
(t9-21 (method-of-object a0-35 spool-push))
(a1-16 (-> arg0 name))
(a2-10 spool-part)
(t0-4 -20.0)
)
(t9-21 a0-35 a1-16 a2-10 self t0-4)
)
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(format
#t
"WARNING: ---------------------> loader stall on art ~S ~D~%"
@@ -1223,14 +1195,7 @@
)
)
)
(let* ((a0-39 *art-control*)
(t9-25 (method-of-object a0-39 spool-push))
(a1-20 (-> arg0 name))
(a2-14 spool-part)
(t0-5 -20.0)
)
(t9-25 a0-39 a1-20 a2-14 self t0-5)
)
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(let
((s2-4
(the-as
@@ -1275,28 +1240,10 @@
)
(goto cfg-88)
)
(let* ((a0-55 *art-control*)
(t9-32 (method-of-object a0-55 spool-push))
(a1-24 (-> arg0 name))
(a2-17 spool-part)
(t0-6 -20.0)
)
(t9-32 a0-55 a1-24 a2-17 self t0-6)
)
(cond
((< (+ spool-part 1) (-> arg0 parts))
(let* ((a0-57 *art-control*)
(t9-33 (method-of-object a0-57 spool-push))
(a1-25 (-> arg0 name))
(a2-18 (+ spool-part 1))
(t0-7 -10.0)
)
(t9-33 a0-57 a1-25 a2-18 self t0-7)
)
)
(else
(set! (-> self skel status) (logand -5 (-> self skel status)))
)
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(if (< (+ spool-part 1) (-> arg0 parts))
(spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0)
(set! (-> self skel status) (logand -5 (-> self skel status)))
)
(dummy-16 *load-state* (ja-aframe-num 0))
(cond
@@ -1380,14 +1327,7 @@
(ja-channel-push! 1 30)
(set! (-> self skel root-channel 0 frame-group) arg1)
(while (!= (-> self skel root-channel 0) (-> self skel channel))
(let* ((a0-11 *art-control*)
(t9-4 (method-of-object a0-11 spool-push))
(a1-3 (-> arg0 name))
(a2-2 arg2)
(t0-0 -20.0)
)
(t9-4 a0-11 a1-3 a2-2 self t0-0)
)
(spool-push *art-control* (-> arg0 name) arg2 self -20.0)
(suspend)
(let ((a0-12 (-> self skel root-channel 0)))
(set!
+12 -50
View File
@@ -1235,14 +1235,7 @@
:code
(behavior ()
(while #t
(let* ((a0-0 *art-control*)
(t9-0 (method-of-object a0-0 spool-push))
(a1-0 "lrocklrg-falling")
(a2-0 0)
(t0-0 -1.0)
)
(t9-0 a0-0 a1-0 a2-0 self t0-0)
)
(spool-push *art-control* "lrocklrg-falling" 0 self -1.0)
(suspend)
)
(none)
@@ -1303,14 +1296,7 @@
(behavior ()
(local-vars (v1-3 symbol) (v1-49 symbol))
(until v1-3
(let* ((a0-0 *art-control*)
(t9-0 (method-of-object a0-0 spool-push))
(a1-0 "lrocklrg-falling")
(a2-0 0)
(t0-0 -1.0)
)
(t9-0 a0-0 a1-0 a2-0 self t0-0)
)
(spool-push *art-control* "lrocklrg-falling" 0 self -1.0)
(suspend)
(set! v1-3 (or (not *target*) (process-grab? *target*)))
)
@@ -1327,16 +1313,12 @@
(let* ((gp-1 (get-process *default-dead-pool* othercam #x4000))
(gp-2 (ppointer->handle (when gp-1
(let
((t9-5 (method-of-type othercam activate))
(a0-8 gp-1)
(a2-3 'othercam)
(a3-1 #x70004000)
)
((t9-5 (method-of-type othercam activate)))
(t9-5
(the-as othercam a0-8)
(the-as othercam gp-1)
self
a2-3
(the-as pointer a3-1)
'othercam
(the-as pointer #x70004000)
)
)
(let
@@ -1367,16 +1349,12 @@
(s5-0 (get-process *default-dead-pool* fuel-cell #x4000))
(s5-1 (ppointer->handle (when s5-0
(let
((t9-8 (method-of-type fuel-cell activate))
(a0-14 s5-0)
(a2-6 'fuel-cell)
(a3-3 #x70004000)
)
((t9-8 (method-of-type fuel-cell activate)))
(t9-8
(the-as fuel-cell a0-14)
(the-as fuel-cell s5-0)
self
a2-6
(the-as pointer a3-3)
'fuel-cell
(the-as pointer #x70004000)
)
)
((the-as
@@ -1398,14 +1376,7 @@
(task-status need-reminder)
)
(set! (-> self movie-start) (the-as uint (-> *display* base-frame-counter)))
(let* ((a0-20 *art-control*)
(t9-11 (method-of-object a0-20 spool-push))
(a1-9 "lrocklrg-falling")
(a2-11 0)
(t0-2 -1.0)
)
(t9-11 a0-20 a1-9 a2-11 self t0-2)
)
(spool-push *art-control* "lrocklrg-falling" 0 self -1.0)
(ja-play-spooled-anim
(new 'static 'spool-anim
:name "lrocklrg-falling"
@@ -1424,12 +1395,7 @@
(the-as art-joint-anim (-> self draw art-group data 3))
(the-as (function process-drawable symbol) false-func)
)
(let ((t9-13 process-entity-status!)
(a1-11 64)
(a2-13 #t)
)
(t9-13 self (the-as entity-perm-status a1-11) a2-13)
)
(process-entity-status! self (entity-perm-status complete) #t)
(cond
((handle->process gp-2)
(deactivate (-> gp-2 process 0))
@@ -1596,7 +1562,3 @@
((method-of-type beach-rock copy-defaults!) obj arg0)
(none)
)
+7 -8
View File
@@ -2377,14 +2377,13 @@ nav-enemy-default-event-handler
(process-entity-status! self (entity-perm-status complete) #t)
(when (not (task-complete? *game-info* (-> self entity extra perm task)))
(label cfg-1)
(let ((t9-5 birth-pickup-at-point)
(a0-4 (-> self collide-info trans))
(a1-2 6)
(a2-1 (the float (the-as int (-> self entity extra perm task))))
(a3-0 #f)
(t1-0 #f)
)
(t9-5 a0-4 a1-2 a2-1 a3-0 self t1-0)
(birth-pickup-at-point
(-> self collide-info trans)
6
(the float (the-as int (-> self entity extra perm task)))
#f
self
#f
)
(when (not (-> self child))
(suspend)